linting formating

This commit is contained in:
gw3000 2023-07-12 12:00:03 +02:00
parent 5fa3dfdafb
commit 4f2e8277df
6 changed files with 61 additions and 74 deletions

View file

@ -15,18 +15,40 @@ def costs_default():
class FallenBird(models.Model): class FallenBird(models.Model):
id = models.UUIDField(primary_key=True, default=uuid4, editable=False) id = models.UUIDField(primary_key=True, default=uuid4, editable=False)
bird_identifier = models.CharField(max_length=256, verbose_name=_("Kennung")) 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")) date_found = models.DateField(verbose_name=_("Datum des Fundes"))
place = models.CharField(max_length=256, verbose_name=_("Ort des Fundes")) place = models.CharField(max_length=256, verbose_name=_("Ort des Fundes"))
created = models.DateTimeField(auto_now_add=True, verbose_name=_("angelegt am")) created = models.DateTimeField(auto_now_add=True, verbose_name=_("angelegt am"))
updated = models.DateTimeField(auto_now=True, verbose_name=_("geändert am")) updated = models.DateTimeField(auto_now=True, verbose_name=_("geändert am"))
find_circumstances = models.ForeignKey("Circumstance", on_delete=models.CASCADE, verbose_name=_("Fundumstände")) find_circumstances = models.ForeignKey(
diagnostic_finding = models.CharField(max_length=256, verbose_name=_("Diagnose bei Fund")) "Circumstance", on_delete=models.CASCADE, verbose_name=_("Fundumstände")
costs = models.DecimalField(max_digits=5, decimal_places=2, verbose_name=_("Kosten")) )
rescuer = models.ForeignKey( Rescuer, on_delete=models.SET_NULL, blank=True, null=True, verbose_name=_("Finder")) diagnostic_finding = models.CharField(
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, verbose_name=_("Benutzer")) max_length=256, verbose_name=_("Diagnose bei Fund")
)
costs = models.DecimalField(
max_digits=5, decimal_places=2, verbose_name=_("Kosten")
)
rescuer = models.ForeignKey(
Rescuer,
on_delete=models.SET_NULL,
blank=True,
null=True,
verbose_name=_("Finder"),
)
user = models.ForeignKey(
settings.AUTH_USER_MODEL, on_delete=models.CASCADE, verbose_name=_("Benutzer")
)
status = models.ForeignKey("BirdStatus", on_delete=models.CASCADE, default=1) status = models.ForeignKey("BirdStatus", on_delete=models.CASCADE, default=1)
aviary = models.ForeignKey(Aviary, on_delete=models.SET_NULL, blank=True, null=True, verbose_name=_("Voliere")) aviary = models.ForeignKey(
Aviary,
on_delete=models.SET_NULL,
blank=True,
null=True,
verbose_name=_("Voliere"),
)
class Meta: class Meta:
verbose_name = _("Patient") verbose_name = _("Patient")
@ -51,7 +73,9 @@ class Bird(models.Model):
class BirdStatus(models.Model): class BirdStatus(models.Model):
id = models.BigAutoField(primary_key=True) id = models.BigAutoField(primary_key=True)
description = models.CharField(max_length=256, unique=True, verbose_name=_("Bezeichnung")) description = models.CharField(
max_length=256, unique=True, verbose_name=_("Bezeichnung")
)
class Meta: class Meta:
verbose_name = _("Patientenstatus") verbose_name = _("Patientenstatus")

View file

@ -29,11 +29,11 @@ SECRET_KEY = ")g-j2v+*dvjtnz)q-3+*y7*lq$el$im8p^wr@2v$g^u99quq50"
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
# DEBUG = True # DEBUG = True
DEBUG = env('DEBUG') DEBUG = env("DEBUG")
# ALLOWED_HOSTS = [] # ALLOWED_HOSTS = []
ALLOWED_HOSTS = env('DJANGO_ALLOWED_HOSTS', default=[]) ALLOWED_HOSTS = env("DJANGO_ALLOWED_HOSTS", default=[])
# Application definition # Application definition
@ -121,7 +121,7 @@ DATABASES = {
# "PASSWORD": "django_traefik", # "PASSWORD": "django_traefik",
# "HOST": "db", # "HOST": "db",
# "PORT": "5432", # "PORT": "5432",
'default': env.db(), "default": env.db(),
} }
} }
@ -131,20 +131,16 @@ DATABASES = {
AUTH_PASSWORD_VALIDATORS = [ AUTH_PASSWORD_VALIDATORS = [
{ {
"NAME": "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
"django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
}, },
{ {
"NAME": "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
"django.contrib.auth.password_validation.MinimumLengthValidator",
}, },
{ {
"NAME": "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
"django.contrib.auth.password_validation.CommonPasswordValidator",
}, },
{ {
"NAME": "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
"django.contrib.auth.password_validation.NumericPasswordValidator",
}, },
] ]
@ -166,7 +162,7 @@ USE_TZ = True
STATIC_URL = "static/" STATIC_URL = "static/"
STATICFILES_DIRS = [BASE_DIR / "static"] STATICFILES_DIRS = [BASE_DIR / "static"]
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
@ -199,90 +195,64 @@ EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
JAZZMIN_SETTINGS = { JAZZMIN_SETTINGS = {
# title of the window (Will default to current_admin_site.site_title if absent or None) # title of the window (Will default to current_admin_site.site_title if absent or None)
"site_title": "FBF Admin", "site_title": "FBF Admin",
# Title on the login screen (19 chars max) (defaults to current_admin_site.site_header if absent or None) # Title on the login screen (19 chars max) (defaults to current_admin_site.site_header if absent or None)
"site_header": "Fallen Birdy App", "site_header": "Fallen Birdy App",
# Title on the brand (19 chars max) (defaults to current_admin_site.site_header if absent or None) # Title on the brand (19 chars max) (defaults to current_admin_site.site_header if absent or None)
"site_brand": "Fallen Birdy App", "site_brand": "Fallen Birdy App",
# Logo to use for your site, must be present in static files, used for brand on top left # Logo to use for your site, must be present in static files, used for brand on top left
# "site_logo": "img/wvhLogo.svg", # "site_logo": "img/wvhLogo.svg",
# Logo to use for your site, must be present in static files, used for login form logo (defaults to site_logo) # Logo to use for your site, must be present in static files, used for login form logo (defaults to site_logo)
"login_logo": None, "login_logo": None,
# Logo to use for login form in dark themes (defaults to login_logo) # Logo to use for login form in dark themes (defaults to login_logo)
"login_logo_dark": None, "login_logo_dark": None,
# CSS classes that are applied to the logo above # CSS classes that are applied to the logo above
"site_logo_classes": "img-circle", "site_logo_classes": "img-circle",
# Relative path to a favicon for your site, will default to site_logo if absent (ideally 32x32 px) # Relative path to a favicon for your site, will default to site_logo if absent (ideally 32x32 px)
"site_icon": None, "site_icon": None,
# Welcome text on the login screen # Welcome text on the login screen
"welcome_sign": "Willkommen bei der FBF-App im Admin-Bereich", "welcome_sign": "Willkommen bei der FBF-App im Admin-Bereich",
# Copyright on the footer # Copyright on the footer
# "copyright": "Acme Library Ltd", # "copyright": "Acme Library Ltd",
# List of model admins to search from the search bar, search bar omitted if excluded # 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 # 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"], "search_model": ["auth.User", "auth.Group"],
# Field name on user model that contains avatar ImageField/URLField/Charfield or a callable that receives the user # Field name on user model that contains avatar ImageField/URLField/Charfield or a callable that receives the user
"user_avatar": None, "user_avatar": None,
############ ############
# Top Menu # # Top Menu #
############ ############
# Links to put along the top menu # Links to put along the top menu
"topmenu_links": [ "topmenu_links": [
# Url that gets reversed (Permissions can be added) # Url that gets reversed (Permissions can be added)
# {"name": "Home", "url": "admin:index", "permissions": ["auth.view_user"]}, # {"name": "Home", "url": "admin:index", "permissions": ["auth.view_user"]},
# external url that opens in a new window (Permissions can be added) # 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}, # {"name": "Support", "url": "https://github.com/farridav/django-jazzmin/issues", "new_window": True},
# model admin to link to (Permissions checked against model) # model admin to link to (Permissions checked against model)
{"model": "auth.User"}, {"model": "auth.User"},
# App with dropdown menu to all its models pages (Permissions checked against models) # App with dropdown menu to all its models pages (Permissions checked against models)
# {"app": "books"}, # {"app": "books"},
], ],
############# #############
# User Menu # # User Menu #
############# #############
# Additional links to include in the user menu on the top right ("app" url type is not allowed) # Additional links to include in the user menu on the top right ("app" url type is not allowed)
# "usermenu_links": [ # "usermenu_links": [
# {"name": "Support", "url": "https://github.com/farridav/django-jazzmin/issues", "new_window": True}, # {"name": "Support", "url": "https://github.com/farridav/django-jazzmin/issues", "new_window": True},
# {"model": "auth.user"} # {"model": "auth.user"}
# ], # ],
############# #############
# Side Menu # # Side Menu #
############# #############
# Whether to display the side menu # Whether to display the side menu
"show_sidebar": True, "show_sidebar": True,
# Whether to aut expand the menu # Whether to aut expand the menu
"navigation_expanded": True, "navigation_expanded": True,
# Hide these apps when generating side menu e.g (auth) # Hide these apps when generating side menu e.g (auth)
# "hide_apps": [], # "hide_apps": [],
# Hide these models when generating side menu (e.g auth.user) # Hide these models when generating side menu (e.g auth.user)
# "hide_models": [], # "hide_models": [],
# List of apps (and/or models) to base side menu ordering off of (does not need to contain all apps/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"], # "order_with_respect_to": ["auth", "books", "books.author", "books.book"],
# Custom links to append to app groups, keyed on app name # Custom links to append to app groups, keyed on app name
# "custom_links": { # "custom_links": {
# "books": [{ # "books": [{
@ -292,7 +262,6 @@ JAZZMIN_SETTINGS = {
# "permissions": ["books.view_book"] # "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 # 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 # for the full list of 5.13.0 free icon classes
# "icons": { # "icons": {
@ -303,13 +272,11 @@ JAZZMIN_SETTINGS = {
# Icons that are used when one is not manually specified # Icons that are used when one is not manually specified
# "default_icon_parents": "fas fa-chevron-circle-right", # "default_icon_parents": "fas fa-chevron-circle-right",
# "default_icon_children": "fas fa-circle", # "default_icon_children": "fas fa-circle",
################# #################
# Related Modal # # Related Modal #
################# #################
# Use modals instead of popups # Use modals instead of popups
# "related_modal_active": False, # "related_modal_active": False,
############# #############
# UI Tweaks # # UI Tweaks #
############# #############
@ -320,7 +287,6 @@ JAZZMIN_SETTINGS = {
"use_google_fonts_cdn": True, "use_google_fonts_cdn": True,
# Whether to show the UI customizer on the sidebar # Whether to show the UI customizer on the sidebar
"show_ui_builder": True, "show_ui_builder": True,
############### ###############
# Change view # # Change view #
############### ###############
@ -332,7 +298,10 @@ JAZZMIN_SETTINGS = {
# - carousel # - carousel
"changeform_format": "horizontal_tabs", "changeform_format": "horizontal_tabs",
# override change forms on a per modeladmin basis # override change forms on a per modeladmin basis
"changeform_format_overrides": {"auth.user": "collapsible", "auth.group": "vertical_tabs"}, "changeform_format_overrides": {
"auth.user": "collapsible",
"auth.group": "vertical_tabs",
},
# Add a language dropdown into the admin # Add a language dropdown into the admin
# "language_chooser": True, # "language_chooser": True,
} }

View file

@ -1,5 +1,3 @@
from django.contrib import admin
from django.contrib import admin from django.contrib import admin
from .models import Rescuer from .models import Rescuer

View file

@ -2,9 +2,7 @@ from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
class RescuerConfig(AppConfig): class RescuerConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField" default_auto_field = "django.db.models.BigAutoField"
name = "rescuer" name = "rescuer"
verbose_name = _("Finder") verbose_name = _("Finder")

View file

@ -15,9 +15,7 @@ class Rescuer(models.Model):
city = models.CharField(max_length=200, verbose_name=_("Stadt")) city = models.CharField(max_length=200, verbose_name=_("Stadt"))
zip_code = models.CharField(max_length=200, verbose_name=_("PLZ")) zip_code = models.CharField(max_length=200, verbose_name=_("PLZ"))
phone = models.CharField(max_length=200, verbose_name=_("Telefon")) phone = models.CharField(max_length=200, verbose_name=_("Telefon"))
user = models.ForeignKey( user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE)
class Meta: class Meta:
verbose_name = _("Finder") verbose_name = _("Finder")