diff --git a/Dockerfile b/Dockerfile index def4af9..cd89d8a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,15 +9,14 @@ RUN apt install gettext -y RUN apt install libpq-dev gcc -y COPY . /app WORKDIR /app -RUN mkdir /app/data -RUN mkdir /app/data/static +RUN mkdir /app/data/static -p RUN mkdir /app/data/media -RUN pip install -e . # Without the -e the library static folder will not be copied by collectstatic! +RUN pip install --no-cache-dir -e . # Without the -e the library static folder will not be copied by collectstatic! RUN nf collectstatic --noinput RUN nf compilemessages --ignore venv -COPY docker/notfellchen.bash /bin/notfellchen +COPY docker/entrypoint.sh /bin/notfellchen EXPOSE 7345 CMD ["notfellchen"] diff --git a/docker/notfellchen.bash b/docker/entrypoint.sh similarity index 100% rename from docker/notfellchen.bash rename to docker/entrypoint.sh diff --git a/pyproject.toml b/pyproject.toml index 3157b25..98513a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,6 +41,7 @@ dependencies = [ "django-super-deduper", "django-allauth[mfa]", "django_debug_toolbar", + "django-admin-extra-buttons" ] dynamic = ["version", "readme"] diff --git a/src/fellchensammlung/admin.py b/src/fellchensammlung/admin.py index 0d43450..933f7e0 100644 --- a/src/fellchensammlung/admin.py +++ b/src/fellchensammlung/admin.py @@ -7,6 +7,8 @@ from django.utils.html import format_html from django.urls import reverse from django.utils.http import urlencode +from admin_extra_buttons.api import ExtraButtonsMixin, button, link + from .models import Language, Text, ReportComment, ReportAdoptionNotice, Log, Timestamp, SearchSubscription, \ SpeciesSpecificURL, ImportantLocation, SocialMediaPost @@ -170,18 +172,26 @@ class SocialMediaPostAdmin(admin.ModelAdmin): @admin.register(Log) -class LogAdmin(admin.ModelAdmin): +class LogAdmin(ExtraButtonsMixin, admin.ModelAdmin): ordering = ["-created_at"] list_filter = ("action",) list_display = ("action", "user", "created_at") actions = ("export_as_csv",) + @admin.action(description=_("Ausgewählte Logs exportieren")) def export_as_csv(self, request, queryset): response = export_to_csv_generic(Log, queryset) return response - export_as_csv.short_description = _("Ausgewählte Logs exportieren") + @button() + def export_all_as_csv(self, request): + actual_queryset = Log.objects.all() + response = export_to_csv_generic(Log, actual_queryset) + return response + @link(href="https://www.google.com/", visible=lambda btn: True) + def invisible(self, button): + button.visible = False admin.site.register(Animal) admin.site.register(Species) diff --git a/src/locale/en/LC_MESSAGES/django.po b/src/locale/en/LC_MESSAGES/django.po index 012831a..5051529 100644 --- a/src/locale/en/LC_MESSAGES/django.po +++ b/src/locale/en/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Notfellchen\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-11-07 14:28+0000\n" -"PO-Revision-Date: 2025-11-07 18:17+0100\n" +"PO-Revision-Date: 2025-11-08 00:33+0100\n" "Last-Translator: Julian-Samuel \n" "Language-Team: English\n" "Language: en\n" @@ -1516,7 +1516,7 @@ msgstr "Adoption Notice deactivated" #: src/fellchensammlung/templates/fellchensammlung/misc/deactivate-an.html:10 msgid "Warum schließt du die Vermittlung?" -msgstr "Why are you closing the adoption notice" +msgstr "Why are you closing the adoption notice?" #: src/fellchensammlung/templates/fellchensammlung/misc/deactivate-an.html:14 msgid "Vermittelt mit Hilfe von Notfellchen" diff --git a/src/notfellchen/settings.py b/src/notfellchen/settings.py index dfe8cf1..9a92a6c 100644 --- a/src/notfellchen/settings.py +++ b/src/notfellchen/settings.py @@ -88,7 +88,6 @@ if config.getboolean('django', 'cache', fallback=False): } } - """ DATABASE """ DB_BACKEND = config.get("database", "backend", fallback="sqlite3") DB_NAME = config.get("database", "name", fallback="notfellchen.sqlite3") @@ -100,7 +99,6 @@ DB_HOST = config.get("database", "host", fallback='') BASE_DIR = Path(__file__).resolve().parent.parent LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale')] - """ CELERY + KEYDB """ CELERY_BROKER_URL = config.get("celery", "broker", fallback="redis://localhost:6379/0") CELERY_RESULT_BACKEND = config.get("celery", "backend", fallback="redis://localhost:6379/0") @@ -246,6 +244,7 @@ INSTALLED_APPS = [ 'drf_spectacular_sidecar', # required for Django collectstatic discovery 'widget_tweaks', "debug_toolbar", + 'admin_extra_buttons', ] MIDDLEWARE = [