I’m using some nested models in the Django admin, and when I saved them, I got the 'Please correct the errors below.’ message at top, however no form fields below showed any errors.
In nested_inlines/helpers.py, I printed out formset and formset.errors in _add_formset_recursive:
Here is formset.errors:
[{'translation': [u'The inline foreign key did not match the parent instance primary key.']}]
Here is the printed representation of formset:
<input id="id_sdensense_set-8-sdentranslation_set-1-sdenexample_set-TOTAL_FORMS" name="sdensense_set-8-sdentranslation_set-1-sdenexample_set-TOTAL_FORMS" type="hidden" value="1" /><input id="id_sdensense_set-8-sdentranslation_set-1-sdenexample_set-INITIAL_FORMS" name="sdensense_set-8-sdentranslation_set-1-sdenexample_set-INITIAL_FORMS" type="hidden" value="0" /><input id="id_sdensense_set-8-sdentranslation_set-1-sdenexample_set-MAX_NUM_FORMS" name="sdensense_set-8-sdentranslation_set-1-sdenexample_set-MAX_NUM_FORMS" type="hidden" value="1000" />
<tr><td colspan="2"><ul class="errorlist"><li>(Hidden field translation) The inline foreign key did not match the parent instance primary key.</li></ul></td></tr>
<tr><th><label for="id_sdensense_set-8-sdentranslation_set-1-sdenexample_set-0-text_en">Text en:</label></th><td><input class="vTextField" id="id_sdensense_set-8-sdentranslation_set-1-sdenexample_set-0-text_en" maxlength="255" name="sdensense_set-8-sdentranslation_set-1-sdenexample_set-0-text_en" type="text" value="¿Did you get that?" /></td></tr>
<tr><th><label for="id_sdensense_set-8-sdentranslation_set-1-sdenexample_set-0-text_es">Text es:</label></th><td><input class="vTextField" id="id_sdensense_set-8-sdentranslation_set-1-sdenexample_set-0-text_es" maxlength="255" name="sdensense_set-8-sdentranslation_set-1-sdenexample_set-0-text_es" type="text" value="¿Entendiste lo que dijo?" /></td></tr>
<tr><th><label for="id_sdensense_set-8-sdentranslation_set-1-sdenexample_set-0-DELETE">Delete:</label></th><td><input id="id_sdensense_set-8-sdentranslation_set-1-sdenexample_set-0-DELETE" name="sdensense_set-8-sdentranslation_set-1-sdenexample_set-0-DELETE" type="checkbox" /><input id="id_sdensense_set-8-sdentranslation_set-1-sdenexample_set-0-translation" name="sdensense_set-8-sdentranslation_set-1-sdenexample_set-0-translation" type="hidden" value="6" /><input id="id_sdensense_set-8-sdentranslation_set-1-sdenexample_set-0-id" name="sdensense_set-8-sdentranslation_set-1-sdenexample_set-0-id" type="hidden" /></td></tr>
I can see the ul errorlist in there, but it is not getting to the actual template that is rendered. So the form knows about it, but it is not in the final rendered html — any ideas what happened to it?
I’m using some nested models in the Django admin, and when I saved them, I got the 'Please correct the errors below.’ message at top, however no form fields below showed any errors.
In nested_inlines/helpers.py, I printed out
formset
andformset.errors
in_add_formset_recursive
:Here is
formset.errors
:[{'translation': [u'The inline foreign key did not match the parent instance primary key.']}]
Here is the printed representation of
formset
:I can see the ul errorlist in there, but it is not getting to the actual template that is rendered. So the form knows about it, but it is not in the final rendered html — any ideas what happened to it?