portier/source/config/admin.py

27 lines
933 B
Python
Raw Normal View History

from django.contrib import admin
from guardian.admin import GuardedModelAdmin
from config.models import Stream, Restream, SRSNode, SRSStreamInstance
@admin.register(Stream)
class StreamAdmin(GuardedModelAdmin):
fields = ['stream', 'name', 'publish_counter']
@admin.register(Restream)
class RestreamAdmin(GuardedModelAdmin):
fields = ['name', 'active', 'stream', 'format', 'target']
@admin.register(SRSNode)
class SRSNodeAdmin(GuardedModelAdmin):
fields = ['name', 'api_base', 'rtmp_base', 'active']
@admin.register(SRSStreamInstance)
class SRSStreamInstanceAdmin(GuardedModelAdmin):
fields = ['stream', 'node']
# Stream Instances are just representations of the streams on the SRS server,
# and should not be addable/editable. Deleting them can be useful though.
def has_change_permission(self, request, obj=None):
return False
def has_add_permission(self, request):
return False