from django.contrib import admin from guardian.admin import GuardedModelAdmin from config.models import Stream, Restream, Pull, 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(Pull) class PullAdmin(GuardedModelAdmin): fields = ['name', 'active', 'stream', 'source'] @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