From 409937552ce4ba83d60a77294b3b7fe238932075 Mon Sep 17 00:00:00 2001 From: Sebastian Gutzeit Date: Wed, 14 Feb 2024 11:37:37 +0100 Subject: [PATCH] =?UTF-8?q?BEMAS:=20Verbesserungen=20Benutzerf=C3=BChrung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bemas/models/base.py | 3 +- bemas/models/models_objectclass.py | 10 ++- bemas/tags.py | 5 +- bemas/templates/bemas/codelist-table.html | 5 +- bemas/templates/bemas/codelists.html | 2 +- .../bemas/generic-objectclass-form.html | 1 + .../bemas/generic-objectclass-table.html | 10 ++- bemas/templates/bemas/index.html | 8 +++ bemas/templates/bemas/map.html | 2 +- bemas/templates/bemas/orphaned-data.html | 2 +- bemas/urls.py | 54 ++++++---------- bemas/views/base.py | 2 + bemas/views/functions.py | 64 +++++++++++++++---- bemas/views/views_codelist.py | 9 --- bemas/views/views_objectclass.py | 60 ++++++++++++----- datenwerft/settings.py | 3 +- 16 files changed, 152 insertions(+), 88 deletions(-) diff --git a/bemas/models/base.py b/bemas/models/base.py index 415767ee..4cc0fcaa 100644 --- a/bemas/models/base.py +++ b/bemas/models/base.py @@ -62,7 +62,8 @@ class Meta(Basemodel.Meta): abstract = True class BasemodelMeta(Basemodel.BasemodelMeta): - table_exclusion_fields = ['created_at', 'updated_at', 'search_content'] + table_exclusion_fields = Basemodel.BasemodelMeta.table_exclusion_fields + table_exclusion_fields.append('search_content') class GeometryObjectclass(Objectclass): diff --git a/bemas/models/models_objectclass.py b/bemas/models/models_objectclass.py index 4f1015aa..4698060a 100644 --- a/bemas/models/models_objectclass.py +++ b/bemas/models/models_objectclass.py @@ -121,6 +121,8 @@ class Meta(Objectclass.Meta): verbose_name_plural = 'Organisationen' class BasemodelMeta(Objectclass.BasemodelMeta): + table_exclusion_fields = Objectclass.BasemodelMeta.table_exclusion_fields + table_exclusion_fields += ['address_house_number', 'address_postal_code', 'address_place'] description = 'Betreiberinnen oder Beschwerdeführerinnen' definite_article = 'die' indefinite_article = 'eine' @@ -275,6 +277,8 @@ class Meta(Objectclass.Meta): verbose_name_plural = 'Personen' class BasemodelMeta(Objectclass.BasemodelMeta): + table_exclusion_fields = Objectclass.BasemodelMeta.table_exclusion_fields + table_exclusion_fields += ['address_house_number', 'address_postal_code', 'address_place'] description = 'Beschwerdeführer:innen oder Ansprechpartner:innen' definite_article = 'die' indefinite_article = 'eine' @@ -442,7 +446,8 @@ class Meta(GeometryObjectclass.Meta): verbose_name_plural = 'Verursacher' class BasemodelMeta(GeometryObjectclass.BasemodelMeta): - table_exclusion_fields = ['created_at', 'updated_at', 'search_content', 'emission_point'] + table_exclusion_fields = Objectclass.BasemodelMeta.table_exclusion_fields + table_exclusion_fields += ['operator_organization', 'operator_person', 'emission_point'] geometry_field = 'emission_point' description = 'Verursacher von Emissionen' definite_article = 'der' @@ -565,7 +570,8 @@ class Meta(GeometryObjectclass.Meta): verbose_name_plural = 'Beschwerden' class BasemodelMeta(GeometryObjectclass.BasemodelMeta): - table_exclusion_fields = ['created_at', 'updated_at', 'search_content', 'immission_point'] + table_exclusion_fields = Objectclass.BasemodelMeta.table_exclusion_fields + table_exclusion_fields.append('immission_point') geometry_field = 'immission_point' description = 'Folgen von Immissionen' definite_article = 'die' diff --git a/bemas/tags.py b/bemas/tags.py index e245ab96..8245bc58 100644 --- a/bemas/tags.py +++ b/bemas/tags.py @@ -8,16 +8,17 @@ @register.filter -def beautify_model_string(model_name): +def beautify_model_string(model_name, plural=True): """ turns passed model name into model verbose name plural with prefixed icon :param model_name: model name + :param plural: title shall be model verbose name plural? :return: passed model name turned into model verbose name plural with prefixed icon """ icon = ''.format(get_icon_from_settings(model_name.lower())) model = apps.get_app_config('bemas').get_model(model_name) - model_title = model._meta.verbose_name_plural + model_title = model._meta.verbose_name_plural if plural else model._meta.verbose_name return icon + ' ' + model_title diff --git a/bemas/templates/bemas/codelist-table.html b/bemas/templates/bemas/codelist-table.html index 8d323902..e45bace7 100644 --- a/bemas/templates/bemas/codelist-table.html +++ b/bemas/templates/bemas/codelist-table.html @@ -32,7 +32,8 @@

{% if is_bemas_admin %} neuen Codelisteneintrag anlegen {% endif %} - zurück + Codelisten + Startseite {% if objects_count > 0 %}
@@ -41,7 +42,7 @@

{% for column_title in column_titles %} - {{ column_title }} + {{ column_title }} {% endfor %} {% if is_bemas_admin %} Aktionen diff --git a/bemas/templates/bemas/codelists.html b/bemas/templates/bemas/codelists.html index a4ff1f53..c5790e69 100644 --- a/bemas/templates/bemas/codelists.html +++ b/bemas/templates/bemas/codelists.html @@ -15,7 +15,7 @@
{{ codelist.description }}
{% endfor %}

- zurück + Startseite {% else %} {% include "bemas/notice-norights.html" %} {% endif %} diff --git a/bemas/templates/bemas/generic-objectclass-form.html b/bemas/templates/bemas/generic-objectclass-form.html index 40269fae..48b8a3a3 100644 --- a/bemas/templates/bemas/generic-objectclass-form.html +++ b/bemas/templates/bemas/generic-objectclass-form.html @@ -56,6 +56,7 @@

{{ objectcl {% endif %}
{% csrf_token %} +
{% for field in form %} diff --git a/bemas/templates/bemas/generic-objectclass-table.html b/bemas/templates/bemas/generic-objectclass-table.html index 020aea8f..d4cb2066 100644 --- a/bemas/templates/bemas/generic-objectclass-table.html +++ b/bemas/templates/bemas/generic-objectclass-table.html @@ -45,7 +45,15 @@

{% if objects_count > 0 and objectclass_name == 'Complaint' or objects_count > 0 and objectclass_name == 'Originator' %} {% endif %} - zurück + {% if objectclass_name == 'LogEntry' and model and reference_table_url %} + {% if object_pk and reference_object_url %} + {{ model|beautify_model_string:False|safe }} mit der ID {{ object_pk }} + {% endif %} + {{ model|beautify_model_string|safe }} + {% elif objectclass_name == 'Event' and complaint_pk and complaint_url %} + Beschwerde mit der ID {{ complaint_pk }} + {% endif %} + Startseite {% if objects_count > 0 %}
diff --git a/bemas/templates/bemas/index.html b/bemas/templates/bemas/index.html index b8ed079d..248ce007 100644 --- a/bemas/templates/bemas/index.html +++ b/bemas/templates/bemas/index.html @@ -6,6 +6,9 @@ {% block content %} {% if is_bemas_user %} + {% if messages %} + {% include "bemas/container-messages.html" %} + {% endif %} {% if not is_mobile %}
@@ -163,6 +166,11 @@
{% endif %} + {% else %} {% include "bemas/notice-norights.html" %} {% endif %} diff --git a/bemas/templates/bemas/map.html b/bemas/templates/bemas/map.html index 29a37b53..3b81368c 100644 --- a/bemas/templates/bemas/map.html +++ b/bemas/templates/bemas/map.html @@ -41,7 +41,7 @@

alle Verursacher - zurück + Startseite

{% if objects_count > 0 %} {% if model and subset_pk %} diff --git a/bemas/templates/bemas/orphaned-data.html b/bemas/templates/bemas/orphaned-data.html index a3d1b3eb..6e62c8d1 100644 --- a/bemas/templates/bemas/orphaned-data.html +++ b/bemas/templates/bemas/orphaned-data.html @@ -56,7 +56,7 @@

Ver keine verwaisten Verursacher vorhanden {% endif %} - zurück + Startseite {% else %} {% include "bemas/notice-norights.html" %} {% endif %} diff --git a/bemas/urls.py b/bemas/urls.py index 26672f62..84cb931d 100644 --- a/bemas/urls.py +++ b/bemas/urls.py @@ -158,8 +158,7 @@ path( 'organization/create', view=login_required(GenericObjectclassCreateView.as_view( - model=model, - success_url=reverse_lazy('bemas:organization_table') + model=model )), name='organization_create' ) @@ -170,8 +169,7 @@ path( 'organization/update/', view=login_required(GenericObjectclassUpdateView.as_view( - model=model, - success_url=reverse_lazy('bemas:organization_table') + model=model )), name='organization_update' ) @@ -182,8 +180,7 @@ path( 'organization/delete/', view=login_required(OrganizationDeleteView.as_view( - model=model, - success_url=reverse_lazy('bemas:organization_table') + model=model )), name='organization_delete' ) @@ -221,8 +218,7 @@ path( 'person/create', view=login_required(GenericObjectclassCreateView.as_view( - model=model, - success_url=reverse_lazy('bemas:person_table') + model=model )), name='person_create' ) @@ -233,8 +229,7 @@ path( 'person/update/', view=login_required(GenericObjectclassUpdateView.as_view( - model=model, - success_url=reverse_lazy('bemas:person_table') + model=model )), name='person_update' ) @@ -245,8 +240,7 @@ path( 'person/delete/', view=login_required(PersonDeleteView.as_view( - model=model, - success_url=reverse_lazy('bemas:person_table') + model=model )), name='person_delete' ) @@ -262,8 +256,7 @@ path( 'contact/create', view=login_required(ContactCreateView.as_view( - model=model, - success_url=reverse_lazy('bemas:organization_table') + model=model )), name='contact_create' ) @@ -274,8 +267,7 @@ path( 'contact/update/', view=login_required(ContactUpdateView.as_view( - model=model, - success_url=reverse_lazy('bemas:organization_table') + model=model )), name='contact_update' ) @@ -286,8 +278,7 @@ path( 'contact/delete/', view=login_required(ContactDeleteView.as_view( - model=model, - success_url=reverse_lazy('bemas:organization_table') + model=model )), name='contact_delete' ) @@ -349,8 +340,7 @@ path( 'originator/create', view=login_required(GenericObjectclassCreateView.as_view( - model=model, - success_url=reverse_lazy('bemas:originator_table') + model=model )), name='originator_create' ) @@ -361,8 +351,7 @@ path( 'originator/update/', view=login_required(GenericObjectclassUpdateView.as_view( - model=model, - success_url=reverse_lazy('bemas:originator_table') + model=model )), name='originator_update' ) @@ -373,8 +362,7 @@ path( 'originator/delete/', view=login_required(GenericObjectclassDeleteView.as_view( - model=model, - success_url=reverse_lazy('bemas:originator_table') + model=model )), name='originator_delete' ) @@ -459,8 +447,7 @@ path( 'complaint/create', view=login_required(GenericObjectclassCreateView.as_view( - model=model, - success_url=reverse_lazy('bemas:complaint_table') + model=model )), name='complaint_create' ) @@ -471,8 +458,7 @@ path( 'complaint/update/', view=login_required(GenericObjectclassUpdateView.as_view( - model=model, - success_url=reverse_lazy('bemas:complaint_table') + model=model )), name='complaint_update' ) @@ -483,8 +469,7 @@ path( 'complaint/delete/', view=login_required(ComplaintDeleteView.as_view( - model=model, - success_url=reverse_lazy('bemas:complaint_table') + model=model )), name='complaint_delete' ) @@ -644,8 +629,7 @@ path( 'event/create', view=login_required(GenericObjectclassCreateView.as_view( - model=model, - success_url=reverse_lazy('bemas:event_table') + model=model )), name='event_create' ) @@ -656,8 +640,7 @@ path( 'event/update/', view=login_required(GenericObjectclassUpdateView.as_view( - model=model, - success_url=reverse_lazy('bemas:event_table') + model=model )), name='event_update' ) @@ -668,8 +651,7 @@ path( 'event/delete/', view=login_required(ComplaintDeleteView.as_view( - model=model, - success_url=reverse_lazy('bemas:event_table') + model=model )), name='event_delete' ) diff --git a/bemas/views/base.py b/bemas/views/base.py index 15b50bdb..19510f26 100644 --- a/bemas/views/base.py +++ b/bemas/views/base.py @@ -281,6 +281,8 @@ def ordering(self, qs): column_names.append(column.name) # handle addresses elif column.name.startswith('address_') and not address_handled: + # append one column for address string + # instead of appending individual columns for all address related values column_names.append(column.name) address_handled = True column_name = column_names[int(order_column)] diff --git a/bemas/views/functions.py b/bemas/views/functions.py index 08dba1d8..3d26c7f0 100644 --- a/bemas/views/functions.py +++ b/bemas/views/functions.py @@ -4,7 +4,7 @@ from django.contrib.auth.models import User from django.core.serializers import serialize from django.forms import Select, Textarea -from django.urls import reverse +from django.urls import reverse, reverse_lazy from django_user_agents.utils import get_user_agent from json import dumps, loads from leaflet.forms.widgets import LeafletWidget @@ -107,20 +107,26 @@ def add_table_context_elements(context, model, kwargs=None): column_titles = [] address_handled = False for field in model._meta.fields: - if not field.name.startswith('address_'): - # handle included fields only! - if field.name not in model.BasemodelMeta.table_exclusion_fields: + # handle included fields only! + if field.name not in model.BasemodelMeta.table_exclusion_fields: + # ordinary columns + if not field.name.startswith('address_'): column_titles.append('Zeitpunkt' if field.name == 'created_at' else field.verbose_name) - # handle addresses - elif field.name.startswith('address_') and not address_handled: - # append one column for address string - # instead of appending individual columns for all address related values - column_titles.append('Anschrift') - address_handled = True + # handle addresses + elif field.name.startswith('address_') and not address_handled: + # append one column for address string + # instead of appending individual columns for all address related values + column_titles.append('Anschrift') + address_handled = True context['column_titles'] = column_titles # determine initial order initial_order = [] if model._meta.ordering: + # reduce fields to included fields only + included_fields = [] + for field in model._meta.fields: + if field.name not in model.BasemodelMeta.table_exclusion_fields: + included_fields.append(field) for field_name in model._meta.ordering: # determine order direction and clean field name if field_name.startswith('-'): @@ -131,7 +137,7 @@ def add_table_context_elements(context, model, kwargs=None): cleaned_field_name = field_name # determine index of field order_index = 0 - for index, field in enumerate(model._meta.fields): + for index, field in enumerate(included_fields): if field.name == cleaned_field_name: order_index = index break @@ -151,16 +157,22 @@ def add_table_context_elements(context, model, kwargs=None): 'bemas:logentry_tabledata_model_object', args=[kwargs['model'], kwargs['object_pk']] ) + context['reference_table_url'] = reverse('bemas:' + kwargs['model'].lower() + '_table') + context['reference_object_url'] = reverse( + 'bemas:' + kwargs['model'].lower() + '_update', args=[kwargs['object_pk']]) elif issubclass(model, LogEntry) and 'model' in kwargs and kwargs['model']: context['tabledata_url'] = reverse( 'bemas:logentry_tabledata_model', args=[kwargs['model']] ) + context['reference_table_url'] = reverse('bemas:' + kwargs['model'].lower() + '_table') elif issubclass(model, Event) and 'complaint_pk' in kwargs and kwargs['complaint_pk']: context['tabledata_url'] = reverse( 'bemas:event_tabledata_complaint', args=[kwargs['complaint_pk']] ) + context['complaint_url'] = reverse( + 'bemas:complaint_update', args=[kwargs['complaint_pk']]) elif ( (issubclass(model, Complaint) or issubclass(model, Originator)) and 'subset_pk' in kwargs @@ -508,6 +520,32 @@ def get_model_objects(model, count=False, kwargs=None): return objects.count() if count else objects +def get_referer(request): + """ + returns referer for passed request + + :param request: request + :return: referer for passed request + """ + return request.META['HTTP_REFERER'] if 'HTTP_REFERER' in request.META else None + + +def get_referer_url(referer, fallback, lazy=False): + """ + returns URL used for "cancel" buttons + and/or used in case of successfully submitted forms + + :param referer: referer URL + :param fallback: fallback URL + :param lazy: lazy? + :return: URL used for "cancel" buttons + and/or used in case of successfully submitted forms + """ + if referer and '/delete' not in referer: + return referer + return reverse_lazy(fallback) if lazy else reverse(fallback) + + def set_generic_objectclass_create_update_delete_context(context, request, model, cancel_url, curr_object=None): """ @@ -527,9 +565,7 @@ def set_generic_objectclass_create_update_delete_context(context, request, model # add other necessary elements to context context = add_generic_objectclass_context_elements(context, model) # optionally add custom cancel URL (called when cancel button is clicked) to context - context['objectclass_cancel_url'] = ( - cancel_url if cancel_url else reverse('bemas:' + model.__name__.lower() + '_table') - ) + context['objectclass_cancel_url'] = cancel_url if cancel_url else reverse('bemas:index') # add deletion URL to context if object exists if curr_object: context['objectclass_deletion_url'] = reverse( diff --git a/bemas/views/views_codelist.py b/bemas/views/views_codelist.py index c111f98c..f5a5543a 100644 --- a/bemas/views/views_codelist.py +++ b/bemas/views/views_codelist.py @@ -41,12 +41,9 @@ def get_context_data(self, **kwargs): class CodelistCreateView(CreateView): """ view for form page for creating a codelist instance - - :param cancel_url: custom cancel URL """ template_name = 'bemas/codelist-form.html' - cancel_url = None def __init__(self, model=None, *args, **kwargs): self.model = model @@ -93,12 +90,9 @@ def form_valid(self, form): class CodelistUpdateView(UpdateView): """ view for form page for updating a codelist instance - - :param cancel_url: custom cancel URL """ template_name = 'bemas/codelist-form.html' - cancel_url = None def __init__(self, model=None, *args, **kwargs): self.model = model @@ -145,12 +139,9 @@ def form_valid(self, form): class CodelistDeleteView(DeleteView): """ view for form page for deleting a codelist instance - - :param cancel_url: custom cancel URL """ template_name = 'bemas/codelist-delete.html' - cancel_url = None def get_context_data(self, **kwargs): """ diff --git a/bemas/views/views_objectclass.py b/bemas/views/views_objectclass.py index 5a5a845b..d6bc31a5 100644 --- a/bemas/views/views_objectclass.py +++ b/bemas/views/views_objectclass.py @@ -11,7 +11,7 @@ from .forms import GenericForm from .functions import add_default_context_elements, add_generic_objectclass_context_elements, \ add_sector_examples_context_element, add_table_context_elements, assign_widget, \ - create_log_entry, generate_foreign_key_objects_list, \ + create_log_entry, generate_foreign_key_objects_list, get_referer, get_referer_url, \ set_generic_objectclass_create_update_delete_context, set_log_action_and_content from toolbox.utils import get_array_first_element, is_geometry_field from bemas.models import GeometryObjectclass, Complaint, Contact, Event, LogEntry, Organization, \ @@ -49,12 +49,9 @@ def get_context_data(self, **kwargs): class GenericObjectclassCreateView(CreateView): """ view for generic form page for creating an instance of an object class - - :param cancel_url: custom cancel URL """ template_name = 'bemas/generic-objectclass-form.html' - cancel_url = None def __init__(self, model=None, *args, **kwargs): self.model = model @@ -74,11 +71,13 @@ def get_context_data(self, **kwargs): :return: dictionary with all context elements for this view """ # set generic object class context for create, update and/or delete views + cancel_url = get_referer_url( + get_referer(self.request), 'bemas:' + self.model.__name__.lower() + '_table') context = set_generic_objectclass_create_update_delete_context( super().get_context_data(**kwargs), self.request, self.model, - self.cancel_url + cancel_url ) # object class originator: # add list of sector examples to context @@ -121,6 +120,13 @@ def form_valid(self, form): :param form: form :return: HTTP response if passed form is valid """ + # return to either the original referer or a default page + referer = form.data.get('original_referer', None) + self.success_url = get_referer_url( + referer if referer else None, + 'bemas:' + self.model.__name__.lower() + '_table', + True + ) # string representation of new complaint equals its primary key # (which is not yet available) and thus use its description here if issubclass(self.model, Complaint): @@ -168,18 +174,16 @@ def form_invalid(self, form, **kwargs): if geometry and '0,0' not in geometry: context_data['geometry'] = geometry context_data['form'] = form + context_data['objectclass_cancel_url'] = form.data.get('original_referer', None) return self.render_to_response(context_data) class GenericObjectclassUpdateView(UpdateView): """ view for generic form page for updating an instance of an object class - - :param cancel_url: custom cancel URL """ template_name = 'bemas/generic-objectclass-form.html' - cancel_url = None def __init__(self, model=None, *args, **kwargs): self.model = model @@ -199,11 +203,13 @@ def get_context_data(self, **kwargs): :return: dictionary with all context elements for this view """ # set generic object class context for create, update and/or delete views + cancel_url = get_referer_url( + get_referer(self.request), 'bemas:' + self.model.__name__.lower() + '_table') context = set_generic_objectclass_create_update_delete_context( super().get_context_data(**kwargs), self.request, self.model, - self.cancel_url, + cancel_url, self.object ) # optionally add log entries link @@ -298,6 +304,13 @@ def form_valid(self, form): :param form: form :return: HTTP response if passed form is valid """ + # return to either the original referer or a default page + referer = form.data.get('original_referer', None) + self.success_url = get_referer_url( + referer if referer else None, + 'bemas:' + self.model.__name__.lower() + '_table', + True + ) success( self.request, '{} {} {} wurde erfolgreich geändert!'.format( @@ -346,6 +359,7 @@ def form_invalid(self, form, **kwargs): getattr(self.model.objects.get(pk=self.object.pk), field.name) ) context_data['form'] = form + context_data['objectclass_cancel_url'] = form.data.get('original_referer', None) return self.render_to_response(context_data) @@ -353,12 +367,10 @@ class GenericObjectclassDeleteView(DeleteView): """ view for generic form page for deleting an instance of an object class - :param cancel_url: custom cancel URL :param deletion_hints: custom deletion hints """ template_name = 'bemas/generic-objectclass-delete.html' - cancel_url = None deletion_hints = None def get_context_data(self, **kwargs): @@ -369,11 +381,13 @@ def get_context_data(self, **kwargs): :return: dictionary with all context elements for this view """ # set generic object class context for create, update and/or delete views + cancel_url = get_referer_url( + get_referer(self.request), 'bemas:' + self.model.__name__.lower() + '_table') context = set_generic_objectclass_create_update_delete_context( super().get_context_data(**kwargs), self.request, self.model, - self.cancel_url + cancel_url ) # optionally add log entries link if not issubclass(self.model, LogEntry): @@ -393,7 +407,13 @@ def form_valid(self, form): :param form: form :return: HTTP response if passed form is valid """ - success_url = self.get_success_url() + # return to either the original referer or a default page + referer = form.data.get('original_referer', None) + if issubclass(self.model, Contact): + fallback_url = 'bemas:organization_table' + else: + fallback_url = 'bemas:' + self.model.__name__.lower() + '_table' + self.success_url = get_referer_url(referer if referer else None, fallback_url, True) try: object_pk, content = self.object.pk, str(self.object) self.object.delete() @@ -414,7 +434,7 @@ def form_valid(self, form): content, self.request.user ) - return HttpResponseRedirect(success_url) + return HttpResponseRedirect(self.success_url) except ProtectedError as exception: error( self.request, @@ -455,11 +475,13 @@ def get_context_data(self, **kwargs): deletion_hint += generate_foreign_key_objects_list(complaints) self.deletion_hints.append(deletion_hint) # set generic object class context for this view + cancel_url = get_referer_url( + get_referer(self.request), 'bemas:' + self.model.__name__.lower() + '_table') context = set_generic_objectclass_create_update_delete_context( super().get_context_data(**kwargs), self.request, self.model, - self.cancel_url + cancel_url ) # add custom deletion hints (shown as text to user) to context context['deletion_hints'] = self.deletion_hints @@ -494,11 +516,13 @@ def get_context_data(self, **kwargs): deletion_hint += generate_foreign_key_objects_list(complaints) self.deletion_hints.append(deletion_hint) # set generic object class context for this view + cancel_url = get_referer_url( + get_referer(self.request), 'bemas:' + self.model.__name__.lower() + '_table') context = set_generic_objectclass_create_update_delete_context( super().get_context_data(**kwargs), self.request, self.model, - self.cancel_url + cancel_url ) # add custom deletion hints (shown as text to user) to context context['deletion_hints'] = self.deletion_hints @@ -526,11 +550,13 @@ def get_context_data(self, **kwargs): deletion_hint += generate_foreign_key_objects_list(events) self.deletion_hints.append(deletion_hint) # set generic object class context for this view + cancel_url = get_referer_url( + get_referer(self.request), 'bemas:' + self.model.__name__.lower() + '_table') context = set_generic_objectclass_create_update_delete_context( super().get_context_data(**kwargs), self.request, self.model, - self.cancel_url + cancel_url ) # add custom deletion hints (shown as text to user) to context context['deletion_hints'] = self.deletion_hints diff --git a/datenwerft/settings.py b/datenwerft/settings.py index ce88bf4a..a9a4951a 100644 --- a/datenwerft/settings.py +++ b/datenwerft/settings.py @@ -200,7 +200,7 @@ 'address': 'house', 'address_to_map': 'location-dot', 'anonymous_complaint': 'link-slash', - 'back': 'backward', + 'back': 'backward-step', 'cancel': 'hand', 'clone': 'clone', 'codelist': 'list', @@ -214,6 +214,7 @@ 'event': 'paperclip', 'filter_off': 'filter-circle-xmark', 'filter_on': 'filter', + 'index': 'backward-fast', 'info': 'circle-info', 'logentry': 'clock-rotate-left', 'map': 'map-location-dot',