From 92fa348eacee7bd664e0915b5ca99fe5e7e52907 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Sun, 8 Apr 2018 13:33:46 +0200 Subject: [PATCH] Federation model admin --- api/funkwhale_api/federation/admin.py | 77 +++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 api/funkwhale_api/federation/admin.py diff --git a/api/funkwhale_api/federation/admin.py b/api/funkwhale_api/federation/admin.py new file mode 100644 index 000000000..ce636299f --- /dev/null +++ b/api/funkwhale_api/federation/admin.py @@ -0,0 +1,77 @@ +from django.contrib import admin + +from . import models + + +@admin.register(models.Actor) +class ActorAdmin(admin.ModelAdmin): + list_display = [ + 'url', + 'domain', + 'preferred_username', + 'type', + 'creation_date', + 'last_fetch_date'] + search_fields = ['url', 'domain', 'preferred_username'] + list_filter = [ + 'type' + ] + + +@admin.register(models.Follow) +class FollowAdmin(admin.ModelAdmin): + list_display = [ + 'actor', + 'target', + 'creation_date' + ] + search_fields = ['actor__url', 'target__url'] + list_select_related = True + + +@admin.register(models.FollowRequest) +class FollowRequestAdmin(admin.ModelAdmin): + list_display = [ + 'actor', + 'target', + 'creation_date', + 'approved' + ] + search_fields = ['actor__url', 'target__url'] + list_filter = [ + 'approved' + ] + list_select_related = True + + +@admin.register(models.Library) +class LibraryAdmin(admin.ModelAdmin): + list_display = [ + 'actor', + 'url', + 'creation_date', + 'fetched_date', + 'tracks_count'] + search_fields = ['actor__url', 'url'] + list_filter = [ + 'federation_enabled', + 'download_files', + 'autoimport', + ] + list_select_related = True + + +@admin.register(models.LibraryTrack) +class LibraryTrackAdmin(admin.ModelAdmin): + list_display = [ + 'title', + 'artist_name', + 'album_title', + 'url', + 'library', + 'creation_date', + 'published_date', + ] + search_fields = [ + 'library__url', 'url', 'artist_name', 'title', 'album_title'] + list_select_related = True