From a4f895de81da717d0332f15a125408dd3f8f3936 Mon Sep 17 00:00:00 2001 From: moanos Date: Thu, 12 Dec 2024 06:40:11 +0100 Subject: [PATCH] feat: add admin for Base Notification --- src/fellchensammlung/admin.py | 10 +++++++++- src/fellchensammlung/models.py | 9 ++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/fellchensammlung/admin.py b/src/fellchensammlung/admin.py index eba175d..eca24e9 100644 --- a/src/fellchensammlung/admin.py +++ b/src/fellchensammlung/admin.py @@ -9,7 +9,7 @@ from django.utils.http import urlencode from .models import User, Language, Text, ReportComment, ReportAdoptionNotice, Log, Timestamp from .models import Animal, Species, RescueOrganization, AdoptionNotice, Location, Rule, Image, ModerationAction, \ - Comment, Report, Announcement, AdoptionNoticeStatus, User, Subscriptions + Comment, Report, Announcement, AdoptionNoticeStatus, User, Subscriptions, BaseNotification from django.utils.translation import gettext_lazy as _ @@ -66,6 +66,7 @@ class UserAdmin(admin.ModelAdmin): export_as_csv.short_description = _("Ausgewählte User exportieren") + def _reported_content_link(obj): reported_content = obj.reported_content return format_html(f'{reported_content}') @@ -104,10 +105,17 @@ class RescueOrganizationAdmin(admin.ModelAdmin): class TextAdmin(admin.ModelAdmin): search_fields = ("title__icontains", "text_code__icontains",) + @admin.register(Comment) class CommentAdmin(admin.ModelAdmin): list_filter = ("user",) + +@admin.register(BaseNotification) +class BaseNotificationAdmin(admin.ModelAdmin): + list_filter = ("user", "read") + + admin.site.register(Animal) admin.site.register(Species) admin.site.register(Location) diff --git a/src/fellchensammlung/models.py b/src/fellchensammlung/models.py index a58f275..2c52f2b 100644 --- a/src/fellchensammlung/models.py +++ b/src/fellchensammlung/models.py @@ -624,10 +624,13 @@ class ModerationAction(models.Model): return f"[{self.action}]: {self.public_comment}" -""" -Membership -""" +class TextTypeChoices(models.TextChoices): + DEDICATED = "dedicated", _("Fest zugeordnet") + MALE = "M", _("Männlich") + MALE_NEUTERED = "M_N", _("Männlich, kastriert") + FEMALE_NEUTERED = "F_N", _("Weiblich, kastriert") + INTER = "I", _("Intergeschlechtlich") class Text(models.Model): """