From 8fc1c4b547a67278b1dc205d8fd4a84ef194a2ad Mon Sep 17 00:00:00 2001 From: gw3000 Date: Tue, 11 Jul 2023 19:17:31 +0200 Subject: [PATCH] translated stuff in admin section --- app/bird/admin.py | 4 +- app/bird/models.py | 14 +- app/core/settings.py | 140 ++++++++++++++++++ app/rescuer/models.py | 14 +- ...hLogo12001200300x.png => wvhLogoTrans.png} | Bin 5 files changed, 154 insertions(+), 18 deletions(-) rename app/static/img/{wvhLogo12001200300x.png => wvhLogoTrans.png} (100%) diff --git a/app/bird/admin.py b/app/bird/admin.py index 6825c0e..3c379f1 100644 --- a/app/bird/admin.py +++ b/app/bird/admin.py @@ -16,9 +16,9 @@ class BirdAdmin(admin.ModelAdmin): @admin.register(BirdStatus) class BirdStatusAdmin(admin.ModelAdmin): - list_display = ["id", "description"] + list_display = ["description"] @admin.register(Circumstance) class CircumstanceAdmin(admin.ModelAdmin): - list_display = ["id", "description"] + list_display = ["description"] diff --git a/app/bird/models.py b/app/bird/models.py index 224ace6..62862f1 100644 --- a/app/bird/models.py +++ b/app/bird/models.py @@ -16,9 +16,7 @@ def costs_default(): class FallenBird(models.Model): id = models.UUIDField(primary_key=True, default=uuid4, editable=False) bird_identifier = models.CharField(max_length=256, verbose_name=_("Kennung")) - bird = models.ForeignKey( - "Bird", on_delete=models.CASCADE, verbose_name=_("Patient") - ) + bird = models.ForeignKey( "Bird", on_delete=models.CASCADE, verbose_name=_("Patient")) date_found = models.DateField(verbose_name=_("Datum des Fundes")) place = models.CharField(max_length=256, verbose_name=_("Ort des Fundes")) created = models.DateTimeField(auto_now_add=True, verbose_name=_("angelegt am")) @@ -26,9 +24,7 @@ class FallenBird(models.Model): find_circumstances = models.ForeignKey("Circumstance", on_delete=models.CASCADE) diagnostic_finding = models.CharField(max_length=256) costs = models.JSONField("Costs", default=costs_default) - rescuer = models.ForeignKey( - Rescuer, on_delete=models.SET_NULL, blank=True, null=True - ) + rescuer = models.ForeignKey( Rescuer, on_delete=models.SET_NULL, blank=True, null=True) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) status = models.ForeignKey("BirdStatus", on_delete=models.CASCADE, default=1) aviary = models.ForeignKey(Aviary, on_delete=models.SET_NULL, blank=True, null=True) @@ -43,7 +39,7 @@ class FallenBird(models.Model): class Bird(models.Model): id = models.UUIDField(primary_key=True, default=uuid4, editable=False) - name = models.CharField(max_length=256, unique=True) + name = models.CharField(max_length=256, unique=True, verbose_name=_("Bezeichnung")) description = models.CharField(max_length=4096, verbose_name=_("Hilfetext")) class Meta: @@ -56,7 +52,7 @@ class Bird(models.Model): class BirdStatus(models.Model): id = models.BigAutoField(primary_key=True) - description = models.CharField(max_length=256, unique=True) + description = models.CharField(max_length=256, unique=True, verbose_name=_("Bezeichnung")) class Meta: verbose_name = _("Patientenstatus") @@ -78,7 +74,7 @@ class BirdStatus(models.Model): class Circumstance(models.Model): id = models.BigAutoField(primary_key=True) - description = models.CharField(max_length=256) + description = models.CharField(max_length=256, verbose_name=_("Bezeichnung")) class Meta: verbose_name = _("Fundumstand") diff --git a/app/core/settings.py b/app/core/settings.py index 17e7073..f464164 100644 --- a/app/core/settings.py +++ b/app/core/settings.py @@ -181,3 +181,143 @@ LOGIN_REDIRECT_URL = "/bird/all" # Email EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" +JAZZMIN_SETTINGS = { + # title of the window (Will default to current_admin_site.site_title if absent or None) + "site_title": "FBF Admin", + + # Title on the login screen (19 chars max) (defaults to current_admin_site.site_header if absent or None) + "site_header": "Fallen Birdy App", + + # Title on the brand (19 chars max) (defaults to current_admin_site.site_header if absent or None) + "site_brand": "Fallen Birdy App", + + # Logo to use for your site, must be present in static files, used for brand on top left + "site_logo": "img/logo_medium.png", + + # Logo to use for your site, must be present in static files, used for login form logo (defaults to site_logo) + "login_logo": None, + + # Logo to use for login form in dark themes (defaults to login_logo) + "login_logo_dark": None, + + # CSS classes that are applied to the logo above + "site_logo_classes": "img-circle", + + # Relative path to a favicon for your site, will default to site_logo if absent (ideally 32x32 px) + "site_icon": None, + + # Welcome text on the login screen + "welcome_sign": "Willkommen im Admin-Bereich", + + # Copyright on the footer + "copyright": "Acme Library Ltd", + + # List of model admins to search from the search bar, search bar omitted if excluded + # If you want to use a single search field you dont need to use a list, you can use a simple string + "search_model": ["auth.User", "auth.Group"], + + # Field name on user model that contains avatar ImageField/URLField/Charfield or a callable that receives the user + "user_avatar": None, + + ############ + # Top Menu # + ############ + + # Links to put along the top menu + "topmenu_links": [ + + # Url that gets reversed (Permissions can be added) + {"name": "Home", "url": "admin:index", "permissions": ["auth.view_user"]}, + + # external url that opens in a new window (Permissions can be added) + {"name": "Support", "url": "https://github.com/farridav/django-jazzmin/issues", "new_window": True}, + + # model admin to link to (Permissions checked against model) + {"model": "auth.User"}, + + # App with dropdown menu to all its models pages (Permissions checked against models) + {"app": "books"}, + ], + + ############# + # User Menu # + ############# + + # Additional links to include in the user menu on the top right ("app" url type is not allowed) + "usermenu_links": [ + {"name": "Support", "url": "https://github.com/farridav/django-jazzmin/issues", "new_window": True}, + {"model": "auth.user"} + ], + + ############# + # Side Menu # + ############# + + # Whether to display the side menu + "show_sidebar": True, + + # Whether to aut expand the menu + "navigation_expanded": True, + + # Hide these apps when generating side menu e.g (auth) + "hide_apps": [], + + # Hide these models when generating side menu (e.g auth.user) + "hide_models": [], + + # List of apps (and/or models) to base side menu ordering off of (does not need to contain all apps/models) + "order_with_respect_to": ["auth", "books", "books.author", "books.book"], + + # Custom links to append to app groups, keyed on app name + "custom_links": { + "books": [{ + "name": "Make Messages", + "url": "make_messages", + "icon": "fas fa-comments", + "permissions": ["books.view_book"] + }] + }, + + # Custom icons for side menu apps/models See https://fontawesome.com/icons?d=gallery&m=free&v=5.0.0,5.0.1,5.0.10,5.0.11,5.0.12,5.0.13,5.0.2,5.0.3,5.0.4,5.0.5,5.0.6,5.0.7,5.0.8,5.0.9,5.1.0,5.1.1,5.2.0,5.3.0,5.3.1,5.4.0,5.4.1,5.4.2,5.13.0,5.12.0,5.11.2,5.11.1,5.10.0,5.9.0,5.8.2,5.8.1,5.7.2,5.7.1,5.7.0,5.6.3,5.5.0,5.4.2 + # for the full list of 5.13.0 free icon classes + "icons": { + "auth": "fas fa-users-cog", + "auth.user": "fas fa-user", + "auth.Group": "fas fa-users", + }, + # Icons that are used when one is not manually specified + "default_icon_parents": "fas fa-chevron-circle-right", + "default_icon_children": "fas fa-circle", + + ################# + # Related Modal # + ################# + # Use modals instead of popups + "related_modal_active": False, + + ############# + # UI Tweaks # + ############# + # Relative paths to custom CSS/JS scripts (must be present in static files) + "custom_css": None, + "custom_js": None, + # Whether to link font from fonts.googleapis.com (use custom_css to supply font otherwise) + "use_google_fonts_cdn": True, + # Whether to show the UI customizer on the sidebar + "show_ui_builder": False, + + ############### + # Change view # + ############### + # Render out the change view as a single form, or in tabs, current options are + # - single + # - horizontal_tabs (default) + # - vertical_tabs + # - collapsible + # - carousel + "changeform_format": "horizontal_tabs", + # override change forms on a per modeladmin basis + "changeform_format_overrides": {"auth.user": "collapsible", "auth.group": "vertical_tabs"}, + # Add a language dropdown into the admin + # "language_chooser": True, +} \ No newline at end of file diff --git a/app/rescuer/models.py b/app/rescuer/models.py index 1be250c..f5715d4 100644 --- a/app/rescuer/models.py +++ b/app/rescuer/models.py @@ -8,13 +8,13 @@ from django.utils.translation import gettext_lazy as _ class Rescuer(models.Model): id = models.UUIDField(primary_key=True, default=uuid4, editable=False) - first_name = models.CharField(max_length=200) - last_name = models.CharField(max_length=200) - street = models.CharField(max_length=200) - street_number = models.CharField(max_length=20) - city = models.CharField(max_length=200) - zip_code = models.CharField(max_length=200) - phone = models.CharField(max_length=200) + first_name = models.CharField(max_length=200, verbose_name=_("Vorname")) + last_name = models.CharField(max_length=200, verbose_name=_("Nachname")) + street = models.CharField(max_length=200, verbose_name=_("Straße")) + street_number = models.CharField(max_length=20, verbose_name=_("Nummer")) + city = models.CharField(max_length=200, verbose_name=_("Stadt")) + zip_code = models.CharField(max_length=200, verbose_name=_("PLZ")) + phone = models.CharField(max_length=200, verbose_name=_("Telefon")) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) class Meta: diff --git a/app/static/img/wvhLogo12001200300x.png b/app/static/img/wvhLogoTrans.png similarity index 100% rename from app/static/img/wvhLogo12001200300x.png rename to app/static/img/wvhLogoTrans.png