diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-06-30 16:38:15 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-06-30 16:38:15 +0200 |
commit | 98dfb2e3b06d04248a39b18019a46c2bb63efb8c (patch) | |
tree | 7406d366ef6baa7b421f98f9bb1aed3bc1b17a29 /ishtar_common | |
parent | 3a4a2cf0ef72f044f0ca1c42fb2714b362252753 (diff) | |
download | Ishtar-98dfb2e3b06d04248a39b18019a46c2bb63efb8c.tar.bz2 Ishtar-98dfb2e3b06d04248a39b18019a46c2bb63efb8c.zip |
Sources wizard: fix author deletion (refs #3634)
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/forms_common.py | 1 | ||||
-rw-r--r-- | ishtar_common/templates/blocks/form_snippet.html | 5 | ||||
-rw-r--r-- | ishtar_common/tests.py | 19 |
3 files changed, 18 insertions, 7 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index b317f77e3..61e9f1a88 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -884,6 +884,7 @@ class AuthorFormSelection(forms.Form): base_model = 'author' associated_models = {'author': models.Author} author = forms.IntegerField( + required=False, widget=widgets.JQueryAutoComplete( "/" + settings.URL_PATH + 'autocomplete-author', associated_model=models.Author, new=True), diff --git a/ishtar_common/templates/blocks/form_snippet.html b/ishtar_common/templates/blocks/form_snippet.html index 2f841e078..5ee88e25f 100644 --- a/ishtar_common/templates/blocks/form_snippet.html +++ b/ishtar_common/templates/blocks/form_snippet.html @@ -10,4 +10,7 @@ </tr> <tr class="help_text" id="{{field.auto_id}}_help"> <td colspan="3"><div>{{field.help_text}}</div></td> - {%endif%}</tr>{% else %}{{field}}{% endif %}{% endfor %} + {%endif%}</tr>{% else %}{{field}}{% if field.errors %} + <tr class='errors'> + <td colspan='3'>{{field.name}} - {{ field.errors }}</td> + </tr>{% endif %}{{field|safe}}{% endif %}{% endfor %} diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index a91a0ba58..174918dd4 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -222,9 +222,11 @@ class WizardTest(object): self.wizard_name): [current_step], } + + # reconstruct a POST request if current_step in form_data: d = form_data[current_step] - if type(d) in (list, tuple): # formset + if type(d) in (list, tuple): # is a formset for d_idx, item in enumerate(d): for k in item: data['{}-{}-{}'.format( @@ -239,16 +241,21 @@ class WizardTest(object): response = self.client.post(url, data, follow=not next_form_is_checked) except ValidationError as e: - # on ManagementForm data is missing or has been tampered - # error verify the wizard_name or step name - raise ValidationError(u"Errors: {} on {}.".format( - u" - ".join(e.messages), current_step)) + msg = u"Errors: {} on {}. On \"ManagementForm data is " \ + u"missing or...\" error verify the wizard_name or " \ + u"step name".format(u" - ".join(e.messages), + current_step) + raise ValidationError(msg) self.check_response(response, current_step) if next_form_is_checked: next_form = self.steps[idx + 1][0] self.assertRedirects( response, - '/{}/{}'.format(self.url_name, next_form)) + '/{}/{}'.format(self.url_name, next_form), + msg_prefix="Redirection to {} has failed - " + "Error on previous form ({})?".format( + next_form, current_step) + ) if idx == len(self.steps) - 1: # last form self.assertRedirects( |