From fc73e9b31998bc06022fdca1364f31d8ff2afd3a Mon Sep 17 00:00:00 2001 From: Thomas Rusiecki Date: Tue, 11 Feb 2025 14:51:11 -0300 Subject: [PATCH] added institution edit view help text and icons --- admin/templates/institution.html | 67 ++++++++++++++++++++------------ admin/views.py | 10 +++++ 2 files changed, 52 insertions(+), 25 deletions(-) diff --git a/admin/templates/institution.html b/admin/templates/institution.html index 88014b9..1d0977b 100644 --- a/admin/templates/institution.html +++ b/admin/templates/institution.html @@ -1,32 +1,49 @@ {% extends "base.html" %} -{% load i18n %} +{% load i18n django_bootstrap5 %} {% block content %} -
-
-

{{ subtitle }}

+
+
+
+

{{ subtitle }}

+
-
-{% load django_bootstrap5 %} -
-{% csrf_token %} -{% if form.errors %} - -{% endif %} -{% bootstrap_form form %} - + + {% csrf_token %} -
+ {% if form.errors %} + + {% endif %} + +
+
+ {% bootstrap_field form.name addon_before='' %} + {% bootstrap_field form.location addon_before='' %} +
+
+ {% bootstrap_field form.responsable_person addon_before='' %} + {% bootstrap_field form.supervisor_person addon_before='' %} + {% bootstrap_field form.logo addon_before='' %} +
+
+ +
+ + {% translate "Cancel" %} + + +
+ +
{% endblock %} diff --git a/admin/views.py b/admin/views.py index df4cf16..a747e72 100644 --- a/admin/views.py +++ b/admin/views.py @@ -127,6 +127,16 @@ class InstitutionView(AdminView, UpdateView): "supervisor_person" ) + def get_form(self, form_class=None): + form = super().get_form(form_class) + form.fields["name"].help_text = _("Full name of the institution.") + form.fields["logo"].help_text = _("URL to the institution's logo.") + form.fields["location"].help_text = _("The address or city of the institution.") + form.fields["responsable_person"].help_text = _("Name of the institution's responsable person.") + form.fields["supervisor_person"].help_text = _("The supervisor's full name.") + + return form + def get_form_kwargs(self): self.object = self.request.user.institution kwargs = super().get_form_kwargs()