From e1fba785bbbde52fee5257df601b4699d62f4976 Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Fri, 10 Jan 2025 10:06:27 +0100 Subject: [PATCH] Remove functionality for generic error This was added so the "This destination cannot be deleted error" could be shown separate from field specific errors, but after the changes done to the delete endpoint this is no longer used. _render_destination_list is complicated enough as-is that removing this makes it a bit nicer --- src/argus/htmx/destination/views.py | 8 +------- src/argus/htmx/templates/htmx/destination/_content.html | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/argus/htmx/destination/views.py b/src/argus/htmx/destination/views.py index c3b2c15b4..3b8597cb5 100644 --- a/src/argus/htmx/destination/views.py +++ b/src/argus/htmx/destination/views.py @@ -70,7 +70,6 @@ def _render_destination_list( request, create_form: Optional[DestinationFormCreate] = None, update_forms: Optional[Sequence[DestinationFormUpdate]] = None, - errors: Optional[Sequence[str]] = None, template: str = "htmx/destination/destination_list.html", ) -> HttpResponse: """Function to render the destinations page. @@ -79,21 +78,16 @@ def _render_destination_list( with errors while retaining the user input. If you want a blank form, pass None. :param update_forms: list of update forms to display. Useful for rendering forms with error messages while retaining the user input. - If this is None, the update forms will be generated from the user's destinations. - :param errors: a list of error messages to display on the page. Will not be tied to - any form fields.""" + If this is None, the update forms will be generated from the user's destinations.""" if create_form is None: create_form = DestinationFormCreate() if update_forms is None: update_forms = _get_update_forms(request.user) - if errors is None: - errors = [] grouped_forms = _group_update_forms_by_media(update_forms) context = { "create_form": create_form, "grouped_forms": grouped_forms, - "errors": errors, } return render(request, template, context=context) diff --git a/src/argus/htmx/templates/htmx/destination/_content.html b/src/argus/htmx/templates/htmx/destination/_content.html index b9be838c4..86081c4a6 100644 --- a/src/argus/htmx/templates/htmx/destination/_content.html +++ b/src/argus/htmx/templates/htmx/destination/_content.html @@ -1,5 +1,4 @@
{% include "htmx/destination/_create_form.html" %} - {% for error in errors %}

{{ error }}

{% endfor %} {% include "htmx/destination/_form_list.html" %}