Skip to content

Commit

Permalink
Remove functionality for generic error
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stveit committed Jan 10, 2025
1 parent eec71cd commit fdfda05
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
8 changes: 1 addition & 7 deletions src/argus/htmx/destination/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,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.
Expand All @@ -74,21 +73,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)

Expand Down
1 change: 0 additions & 1 deletion src/argus/htmx/templates/htmx/destination/_content.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<div id="destination-content">
{% include "htmx/destination/_create_form.html" %}
{% for error in errors %}<p class="text-error">{{ error }}</p>{% endfor %}
{% include "htmx/destination/_form_list.html" %}
</div>

0 comments on commit fdfda05

Please sign in to comment.