mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 08:39:16 +02:00
[EPIC] Audio metadata update - UI / API
This commit is contained in:
parent
1a1c62ab37
commit
e0c5ffcb16
59 changed files with 2793 additions and 436 deletions
|
@ -1,6 +1,9 @@
|
|||
from django.contrib.admin import register as initial_register, site, ModelAdmin # noqa
|
||||
from django.db.models.fields.related import RelatedField
|
||||
|
||||
from . import models
|
||||
from . import tasks
|
||||
|
||||
|
||||
def register(model):
|
||||
"""
|
||||
|
@ -17,3 +20,28 @@ def register(model):
|
|||
return initial_register(model)(modeladmin)
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
def apply(modeladmin, request, queryset):
|
||||
queryset.update(is_approved=True)
|
||||
for id in queryset.values_list("id", flat=True):
|
||||
tasks.apply_mutation.delay(mutation_id=id)
|
||||
|
||||
|
||||
apply.short_description = "Approve and apply"
|
||||
|
||||
|
||||
@register(models.Mutation)
|
||||
class MutationAdmin(ModelAdmin):
|
||||
list_display = [
|
||||
"uuid",
|
||||
"type",
|
||||
"created_by",
|
||||
"creation_date",
|
||||
"applied_date",
|
||||
"is_approved",
|
||||
"is_applied",
|
||||
]
|
||||
search_fields = ["created_by__preferred_username"]
|
||||
list_filter = ["type", "is_approved", "is_applied"]
|
||||
actions = [apply]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue