Jarvis/jarvis/profiles/admin.py

36 lines
1.1 KiB
Python
Raw Normal View History

2023-04-25 17:06:14 +02:00
from django.contrib import admin
2023-04-27 13:09:55 +02:00
from django_admin_listfilter_dropdown.filters import RelatedDropdownFilter
2024-02-11 09:25:20 +01:00
from .models import Profile, Notification, TrainerGymnast
2023-04-25 17:06:14 +02:00
class ProfileAdmin(admin.ModelAdmin):
model = Profile
list_display = ("user", "template_color", "sidebar_color")
autocomplete_fields = ("user",)
2023-04-27 15:05:53 +02:00
class NotificationAdmin(admin.ModelAdmin):
model = Notification
list_display = ("user", "gymnast", "functionality")
autocomplete_fields = ("user", "gymnast")
list_filter = (
("user", RelatedDropdownFilter),
("gymnast", RelatedDropdownFilter),
("functionality", RelatedDropdownFilter),
)
2023-04-25 17:06:14 +02:00
2024-02-11 09:25:20 +01:00
class TrainerGymnastAdmin(admin.ModelAdmin):
model = TrainerGymnast
list_display = ("user", "gymnast")
autocomplete_fields = ("user", "gymnast")
list_filter = (
("user", RelatedDropdownFilter),
("gymnast", RelatedDropdownFilter),
)
admin.site.register(Profile, ProfileAdmin)
2023-04-27 15:05:53 +02:00
admin.site.register(Notification, NotificationAdmin)
2024-02-11 09:25:20 +01:00
admin.site.register(TrainerGymnast, TrainerGymnastAdmin)