portier/source/config/admin.py

32 lines
1.0 KiB
Python
Raw Normal View History

from django.contrib import admin
from guardian.admin import GuardedModelAdmin
2024-04-01 16:27:31 +02:00
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']
2024-04-01 16:27:31 +02:00
@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):
2024-04-01 16:27:31 +02:00
return False