Commit ce45b252 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Merge branch '80-admins' into 'develop'

Fixed #80: Added admin interface for radios, track files, favorites...

Closes #80

See merge request funkwhale/funkwhale!69
parents 6cc12a4c e13ac323
from django.contrib import admin
from . import models
@admin.register(models.TrackFavorite)
class TrackFavoriteAdmin(admin.ModelAdmin):
list_display = ['user', 'track', 'creation_date']
list_select_related = [
'user',
'track'
]
......@@ -6,3 +6,7 @@ from . import models
class ListeningAdmin(admin.ModelAdmin):
list_display = ['track', 'end_date', 'user', 'session_key']
search_fields = ['track__name', 'user__username']
list_select_related = [
'user',
'track'
]
......@@ -25,13 +25,26 @@ class TrackAdmin(admin.ModelAdmin):
@admin.register(models.ImportBatch)
class ImportBatchAdmin(admin.ModelAdmin):
list_display = ['creation_date', 'status']
list_display = [
'submitted_by',
'creation_date',
'import_request',
'status']
list_select_related = [
'submitted_by',
'import_request',
]
list_filter = ['status']
search_fields = [
'import_request__name', 'source', 'batch__pk', 'mbid']
@admin.register(models.ImportJob)
class ImportJobAdmin(admin.ModelAdmin):
list_display = ['source', 'batch', 'track_file', 'status', 'mbid']
list_select_related = True
list_select_related = [
'track_file',
'batch',
]
search_fields = ['source', 'batch__pk', 'mbid']
list_filter = ['status']
......@@ -50,3 +63,19 @@ class LyricsAdmin(admin.ModelAdmin):
list_select_related = True
search_fields = ['url', 'work__title']
list_filter = ['work__language']
@admin.register(models.TrackFile)
class TrackFileAdmin(admin.ModelAdmin):
list_display = [
'track',
'audio_file',
'source',
'duration',
'mimetype',
]
list_select_related = [
'track'
]
search_fields = ['source', 'acoustid_track_id']
list_filter = ['mimetype']
from django.contrib import admin
from . import models
@admin.register(models.Radio)
class RadioAdmin(admin.ModelAdmin):
list_display = [
'user', 'name', 'is_public', 'creation_date', 'config']
list_select_related = [
'user',
]
list_filter = [
'is_public',
]
search_fields = ['name', 'description']
@admin.register(models.RadioSession)
class RadioSessionAdmin(admin.ModelAdmin):
list_display = [
'user',
'custom_radio',
'radio_type',
'creation_date',
'related_object']
list_select_related = [
'user',
'custom_radio'
]
list_filter = [
'radio_type',
]
@admin.register(models.RadioSessionTrack)
class RadioSessionTrackAdmin(admin.ModelAdmin):
list_display = [
'id',
'session',
'position',
'track',]
list_select_related = [
'track',
'session'
]
from django.contrib import admin
from . import models
@admin.register(models.ImportRequest)
class ImportRequestAdmin(admin.ModelAdmin):
list_display = ['artist_name', 'user', 'status', 'creation_date']
list_select_related = [
'user',
'track'
]
list_filter = [
'status',
]
search_fields = ['artist_name', 'comment', 'albums']
Added admin interface for radios, track files, favorites and import requests (#80)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment