28 lines
923 B
Python
28 lines
923 B
Python
from django.contrib import admin
|
|
|
|
from .models import OdyseeChannel, OdyseeRelease, Tag
|
|
|
|
# Register your models here.
|
|
@admin.register(OdyseeChannel)
|
|
class OdyseeChannelAdmin(admin.ModelAdmin):
|
|
list_display = ['name', 'handle', 'description', 'id']
|
|
search_fields = ['name', 'description', 'handle']
|
|
ordering = ['name']
|
|
|
|
@admin.register(OdyseeRelease)
|
|
class OdyseeReleaseAdmin(admin.ModelAdmin):
|
|
list_display = ['name', 'channel', 'released', 'get_tags', 'filehash', 'id']
|
|
search_fields = ['name', 'url', 'filehash']
|
|
ordering = ['channel', 'name', 'released']
|
|
list_filter = ['channel', 'tags', 'released']
|
|
|
|
def get_tags(self, obj):
|
|
return ", ".join([str(tag) for tag in obj.tags.all()])
|
|
get_tags.short_description = "Tags"
|
|
|
|
@admin.register(Tag)
|
|
class TagAdmin(admin.ModelAdmin):
|
|
list_display = ['name', 'description', 'id']
|
|
search_fields = ['name']
|
|
ordering = ['name']
|