diff --git a/intervention/templates/intervention/detail-view.html b/intervention/templates/intervention/detail-view.html index 920c791e..9351f8b0 100644 --- a/intervention/templates/intervention/detail-view.html +++ b/intervention/templates/intervention/detail-view.html @@ -82,7 +82,7 @@ {{intervention.conservation_file_number|default_if_none:""}} - {% trans 'Handler' %} + {% trans 'Intervention handler' %} {{intervention.handler|default_if_none:""}} @@ -181,12 +181,12 @@ {% for comp in intervention.compensations.all %} - + {{ comp.identifier }} - {{ comp.title }} + {{ comp.title }} {% endfor %} @@ -230,12 +230,14 @@ {% for pay in intervention.payments.all %} - - - {{ pay.amount }} - {{ pay.comment }} - - + + + + {{ pay.amount }} + + + {{ pay.comment }} + {% endfor %} @@ -256,7 +258,7 @@
- + + + {% endfor %} @@ -294,54 +306,6 @@
-
- -
{% endblock %} \ No newline at end of file diff --git a/konova/admin.py b/konova/admin.py index cb4c822a..6fc31b76 100644 --- a/konova/admin.py +++ b/konova/admin.py @@ -7,7 +7,7 @@ Created on: 22.07.21 """ from django.contrib import admin -from konova.models import Geometry +from konova.models import Geometry, Document class GeometryAdmin(admin.ModelAdmin): @@ -18,4 +18,15 @@ class GeometryAdmin(admin.ModelAdmin): ] +class DocumentAdmin(admin.ModelAdmin): + list_display = [ + "id", + "title", + "comment", + "created_on", + "created_by", + ] + + admin.site.register(Geometry, GeometryAdmin) +admin.site.register(Document, DocumentAdmin) diff --git a/konova/static/css/konova.css b/konova/static/css/konova.css index abf6e3f8..04cb9af1 100644 --- a/konova/static/css/konova.css +++ b/konova/static/css/konova.css @@ -132,7 +132,7 @@ a { .btn-default{ color: white; background-color: var(--rlp-red); - border-radius: 0; + border-radius: 0.15rem; } .btn-default:hover{ /* diff --git a/konova/urls.py b/konova/urls.py index 0dc1fe76..74ad3f1d 100644 --- a/konova/urls.py +++ b/konova/urls.py @@ -20,7 +20,7 @@ from simple_sso.sso_client.client import Client from konova.autocompletes import OrganisationAutocomplete, NonOfficialOrganisationAutocomplete from konova.settings import SSO_SERVER, SSO_PUBLIC_KEY, SSO_PRIVATE_KEY, DEBUG -from konova.views import logout_view, home_view, get_document_view +from konova.views import logout_view, home_view, get_document_view, new_document_view, remove_document_view sso_client = Client(SSO_SERVER, SSO_PUBLIC_KEY, SSO_PRIVATE_KEY) urlpatterns = [ @@ -34,7 +34,11 @@ urlpatterns = [ path('organisation/', include("organisation.urls")), path('user/', include("user.urls")), path('news/', include("news.urls")), + + # Documents path('document/', get_document_view, name="doc-open"), + path('document/new', new_document_view, name="doc-new"), + path('document//remove>', remove_document_view, name="doc-remove"), # Autocomplete paths path("atcmplt/orgs", OrganisationAutocomplete.as_view(), name="orgs-autocomplete"), diff --git a/konova/views.py b/konova/views.py index 43d38ead..76ca956f 100644 --- a/konova/views.py +++ b/konova/views.py @@ -5,11 +5,13 @@ Contact: michel.peltriaux@sgdnord.rlp.de Created on: 16.11.20 """ +from django.contrib import messages from django.contrib.auth import logout from django.contrib.auth.decorators import login_required from django.http import HttpRequest, FileResponse from django.shortcuts import redirect, render, get_object_or_404 from django.utils import timezone +from django.utils.translation import gettext_lazy as _ from konova.contexts import BaseContext from konova.models import Document @@ -66,6 +68,7 @@ def home_view(request: HttpRequest): return render(request, template, context) +@login_required def get_document_view(request: HttpRequest, id: str): """ Returns a document as downloadable attachment @@ -77,4 +80,41 @@ def get_document_view(request: HttpRequest, id: str): """ doc = get_object_or_404(Document, id=id) - return FileResponse(doc.file, as_attachment=True) + return FileResponse(doc.document, as_attachment=True) + + +@login_required +def new_document_view(request: HttpRequest): + """ Renders a form for uploading new documents + + Args: + request (HttpRequest): The incoming request + + Returns: + + """ + template = "" + # TODO + context = {} + context = BaseContext(request, context).context + return render(request, template, context) + + +@login_required +def remove_document_view(request: HttpRequest, id: str): + """ Renders a form for uploading new documents + + Args: + request (HttpRequest): The incoming request + + Returns: + + """ + doc = get_object_or_404(Document, id=id) + title = doc.title + #doc.delete() + messages.success( + request, + _("Document '{}' deleted").format(title) + ) + return redirect(request.META.get("HTTP_REFERER", "home")) diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo index 0db3be9e..b460f644 100644 Binary files a/locale/de/LC_MESSAGES/django.mo and b/locale/de/LC_MESSAGES/django.mo differ diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 4d480dbe..886893b7 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -4,14 +4,14 @@ # FIRST AUTHOR , YEAR. # #: intervention/filters.py:25 intervention/filters.py:31 -#: intervention/filters.py:38 intervention/filters.py:39 konova/forms.py:73 +#: intervention/filters.py:38 intervention/filters.py:39 konova/forms.py:71 #: user/forms.py:38 #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-07-22 16:04+0200\n" +"POT-Creation-Date: 2021-07-23 16:00+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -23,14 +23,15 @@ msgstr "" #: compensation/tables.py:18 compensation/tables.py:71 intervention/forms.py:26 #: intervention/tables.py:23 -#: intervention/templates/intervention/detail-view.html:162 +#: intervention/templates/intervention/detail-view.html:174 msgid "Identifier" msgstr "Kennung" #: compensation/tables.py:23 compensation/tables.py:76 intervention/forms.py:33 #: intervention/tables.py:28 #: intervention/templates/intervention/detail-view.html:57 -#: intervention/templates/intervention/detail-view.html:165 +#: intervention/templates/intervention/detail-view.html:177 +#: intervention/templates/intervention/detail-view.html:276 msgid "Title" msgstr "Bezeichnung" @@ -43,7 +44,7 @@ msgid "Actions" msgstr "Aktionen" #: compensation/tables.py:44 -#: intervention/templates/intervention/detail-view.html:142 +#: intervention/templates/intervention/detail-view.html:154 msgid "Compensations" msgstr "Kompensationen" @@ -100,14 +101,16 @@ msgid "Which intervention type is this" msgstr "Welcher Eingriffstyp" #: intervention/forms.py:44 +#: intervention/templates/intervention/detail-view.html:65 msgid "Law" -msgstr "Recht" +msgstr "Gesetz" #: intervention/forms.py:47 msgid "Based on which law" msgstr "Basiert auf welchem Recht" #: intervention/forms.py:50 +#: intervention/templates/intervention/detail-view.html:85 msgid "Intervention handler" msgstr "Eingriffsverursacher" @@ -156,12 +159,12 @@ msgid "Edit intervention" msgstr "Eingriff bearbeiten" #: intervention/tables.py:33 -#: intervention/templates/intervention/detail-view.html:77 +#: intervention/templates/intervention/detail-view.html:89 msgid "Checked" msgstr "Geprüft" #: intervention/tables.py:39 -#: intervention/templates/intervention/detail-view.html:91 +#: intervention/templates/intervention/detail-view.html:103 msgid "Recorded" msgstr "Verzeichnet" @@ -237,61 +240,85 @@ msgid "Delete" msgstr "Löschen" #: intervention/templates/intervention/detail-view.html:61 +msgid "Process type" +msgstr "Verfahrenstyp" + +#: intervention/templates/intervention/detail-view.html:69 msgid "Registration office" msgstr "Zulassungsbehörde" -#: intervention/templates/intervention/detail-view.html:65 +#: intervention/templates/intervention/detail-view.html:73 msgid "Registration office file number" msgstr "Aktenzeichen Zulassungsbehörde" -#: intervention/templates/intervention/detail-view.html:69 +#: intervention/templates/intervention/detail-view.html:77 msgid "Conservation office" msgstr "Naturschutzbehörde" -#: intervention/templates/intervention/detail-view.html:73 +#: intervention/templates/intervention/detail-view.html:81 msgid "Conversation office file number" msgstr "Aktenzeichen Naturschutzbehörde" -#: intervention/templates/intervention/detail-view.html:105 +#: intervention/templates/intervention/detail-view.html:117 msgid "Registration date" msgstr "Datum Zulassung bzw. Satzungsbeschluss" -#: intervention/templates/intervention/detail-view.html:109 +#: intervention/templates/intervention/detail-view.html:121 msgid "Binding on" msgstr "Datum Bestandskraft" -#: intervention/templates/intervention/detail-view.html:113 +#: intervention/templates/intervention/detail-view.html:125 msgid "Last modified" msgstr "Zuletzt bearbeitet" -#: intervention/templates/intervention/detail-view.html:117 +#: intervention/templates/intervention/detail-view.html:129 msgid "by" msgstr "von" -#: intervention/templates/intervention/detail-view.html:126 +#: intervention/templates/intervention/detail-view.html:138 msgid "No geometry added, yet." msgstr "Keine Geometrie vorhanden" -#: intervention/templates/intervention/detail-view.html:147 +#: intervention/templates/intervention/detail-view.html:159 msgid "Add new compensation" msgstr "Neue Kompensation hinzufügen" -#: intervention/templates/intervention/detail-view.html:192 +#: intervention/templates/intervention/detail-view.html:204 msgid "Payments" msgstr "Ersatzzahlungen" -#: intervention/templates/intervention/detail-view.html:197 +#: intervention/templates/intervention/detail-view.html:209 msgid "Add new payment" msgstr "Neue Zahlung hinzufügen" -#: intervention/templates/intervention/detail-view.html:212 +#: intervention/templates/intervention/detail-view.html:224 msgid "Amount" msgstr "Betrag" -#: intervention/templates/intervention/detail-view.html:215 +#: intervention/templates/intervention/detail-view.html:227 msgid "Transfer comment" msgstr "Verwendungszweck" +#: intervention/templates/intervention/detail-view.html:256 +msgid "Documents" +msgstr "Dokumente" + +#: intervention/templates/intervention/detail-view.html:261 +msgid "Add new document" +msgstr "Neues Dokument hinzufügen" + +#: intervention/templates/intervention/detail-view.html:279 +msgid "Comment" +msgstr "Kommentar" + +#: intervention/templates/intervention/detail-view.html:282 +msgid "Action" +msgstr "Aktionen" + +#: intervention/templates/intervention/detail-view.html:297 +msgid "Remove document" +msgstr "Dokument löschen" + #: intervention/views.py:62 msgid "Intervention {} added" msgstr "Eingriff {} hinzugefügt" @@ -326,19 +353,19 @@ msgstr "Hierfür müssen Sie Administrator sein!" msgid "You need to be part of another user group." msgstr "Hierfür müssen Sie einer anderen Nutzergruppe angehören!" -#: konova/forms.py:46 +#: konova/forms.py:44 msgid "Not editable" msgstr "Nicht editierbar" -#: konova/forms.py:72 +#: konova/forms.py:70 msgid "Confirm" msgstr "Bestätigen" -#: konova/forms.py:84 +#: konova/forms.py:82 msgid "Remove" msgstr "Entferne" -#: konova/forms.py:86 +#: konova/forms.py:84 msgid "You are about to remove {} {}" msgstr "Sie sind dabei {} {} zu löschen" @@ -394,6 +421,12 @@ msgstr "Ökokonto" msgid "Withdraw" msgstr "Abbuchen" +#: konova/views.py:118 +#, fuzzy +#| msgid "Document identifier" +msgid "Document '{}' deleted" +msgstr "Aktenzeichen" + #: news/templates/news/dashboard-news.html:12 news/templates/news/index.html:19 msgid "Published on" msgstr "Veröffentlicht am" @@ -1922,9 +1955,6 @@ msgstr "" #~ msgid "Intervention identifier" #~ msgstr "Eingriffskennung" -#~ msgid "Processes" -#~ msgstr "Vorgänge" - #~ msgid "" #~ "A process is based on an intervention. Please fill in the missing data " #~ "for this intervention" @@ -1962,9 +1992,6 @@ msgstr "" #~ msgid "Registration office document identifier" #~ msgstr "Aktenzeichen Eintragungsstelle" -#~ msgid "Document identifier" -#~ msgstr "Aktenzeichen" - #~ msgid "Date" #~ msgstr "Datum"