From: Magnus Hagander Date: Sat, 17 Nov 2018 17:33:12 +0000 (+0100) Subject: Support special edit-warnings in backend forms X-Git-Tag: FINAL_PY2~43 X-Git-Url: http://git.postgresql.org/gitweb/static/benefitdownload/file?a=commitdiff_plain;h=b1fb97cb5f7d4349dde0c902410caffc98fb24f9;p=pgeu-web.git Support special edit-warnings in backend forms This can be used to highlight special things to consider. For example, and also implemented, show a warning when a registration that has already been confirmed is being edited. --- diff --git a/postgresqleu/confreg/backendforms.py b/postgresqleu/confreg/backendforms.py index 360990c..e4d674c 100644 --- a/postgresqleu/confreg/backendforms.py +++ b/postgresqleu/confreg/backendforms.py @@ -244,6 +244,9 @@ class BackendRegistrationForm(BackendForm): 'additionaloptions'] def fix_fields(self): + if self.instance.payconfirmedat: + self.warning_text = "WARNING! This registration has already been completed! Edit with caution!" + self.fields['additionaloptions'].queryset = ConferenceAdditionalOption.objects.filter(conference=self.conference) if not self.conference.askfood: del self.fields['dietary'] diff --git a/template/confreg/admin_backend_form_content.html b/template/confreg/admin_backend_form_content.html index 690f2c4..366c9cf 100644 --- a/template/confreg/admin_backend_form_content.html +++ b/template/confreg/admin_backend_form_content.html @@ -1,4 +1,7 @@ {%load dictutil%} +{%if form.warning_text %} +
{{form.warning_text}}
+{%endif%} {%if form.non_field_errors%}
{{form.non_field_errors}}
{%endif%} @@ -41,6 +44,9 @@ {%endfor%} {%if not nobuttons%} +{%if form.warning_text %} +
{{form.warning_text}}
+{%endif%}