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

SortableStackedInlineBase fails if the fields is defined as a tuple #302

Closed
wants to merge 1 commit into from

Conversation

peterfarrell
Copy link

SortableStackedInlineBase fails if the fields is defined as a tuple in an admin.py instead of a list (both tuples and lists are acceptable in admin.py). Suit failed on trying to use remove() on an immutable tuple (because it doesn't exist in tuples).

PR puts in an assert to make sure we are not dealing with a tuple and at least give direction on how to fix.

File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py" in get_formset
  1,600.             fields = flatten_fieldsets(self.get_fieldsets(request, obj))
File "/usr/local/lib/python2.7/dist-packages/suit/admin.py" in get_fieldsets
  97.                     fields.remove(self.sortable)

Exception Type: AttributeError at /admin/myapp/someobject/2/
Exception Value: 'tuple' object has no attribute 'remove'

Tuples for fields are immutable and SortableStackedInlineBase fails if the `fields` is defined in an admin.py as a tuple instead of a list.
@darklow darklow closed this in 2730009 Nov 19, 2014
@darklow
Copy link
Owner

darklow commented Nov 19, 2014

Refactored a bit. Thanks for PR.

@peterfarrell
Copy link
Author

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants