Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiValueDictKeyError in Django 1.6 #17

Open
sherlockth opened this issue Dec 12, 2013 · 7 comments
Open

MultiValueDictKeyError in Django 1.6 #17

sherlockth opened this issue Dec 12, 2013 · 7 comments

Comments

@sherlockth
Copy link

After upgrading to Django 1.6 I get a "MultiValueDictKeyError" after trying to add or delete a nested-inline object.

@Gwildor
Copy link

Gwildor commented Jan 27, 2014

This seems to be due to a change in the admin templates in 1.6. See this issue on another project: jazzband/django-admin-sortable#64
And the commit that fixed it:
jazzband/django-admin-sortable@469e7d5

Not sure what the problem is exactly, I'm going to dig into the templates now to see if I can fix it as well.

@sherlockth
Copy link
Author

Thanx man!

@Gwildor
Copy link

Gwildor commented Jan 27, 2014

Alright I seem to have fixed it, at least for me on the project I'm working on. I might make a pull request on SilverFix' repo which generally seems to be more stable and which is the one I am running myself ( https://github.com/silverfix/django-nested-inlines ) but for now you can do this:

  • Override the templates admin/edit_inline/stacked.html and admin/edit_inline/tabular.html by copying the contents from the repo (I used the ones from https://github.com/silverfix/django-nested-inlines/tree/master/nested_inlines/templates/admin/edit_inline ) and placing them in your own project.
  • Look for the line {% if inline_admin_form.has_auto_field %}{{ inline_admin_form.pk_field.field }}{% endif %}
  • Replace that line with {% if inline_admin_form.needs_explicit_pk_field %}{{ inline_admin_form.pk_field.field }}{% endif %}
  • Do this for both templates.

Note that, because the templates in Soaa-'s and SilverFix' repo's are based on Django 1.5, you will loose any changes in Django 1.6 for those two templates, but this is the easiest way to solve this for now.

@sherlockth
Copy link
Author

Thanks man, I will try it out. So the SilverFix nested inlines don't have this problem? Should I just install SilverFix's to try it out, do you think I will have problems?

@Gwildor
Copy link

Gwildor commented Jan 27, 2014

Well like I said I use SilverFix' version because that one is way more active (last update 19 days ago versus 9 months) and generally seems more stable because of some big bugfixes, so yeah, I recommend his version. But his version also has his bug, that's how I ran into it.

Note by the way that there is a visual bug in inlines.js with the "add more" button. This is a div in the inlines.js version of the repo, but in Django 1.6 it has become a proper tr element. You can override inlines.js in the same manor as the templates and alter that to fix that visual bug:

  • Look for the line if ($this.attr("tagName") == "TR") {
  • Replace it with if ($this.prop("tagName") == "TR") {

@sherlockth
Copy link
Author

Perfect, I'll give it a go, thanks again.

@sherlockth
Copy link
Author

Ok, I tried it and it worked! Thank you very much Gwildor!

PetrDlouhy pushed a commit to PetrDlouhy/django-nested-inlines that referenced this issue Apr 18, 2017
changed test_project to example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants