[bug] get_formsets may not drop inlines #418

apollo13 opened this Issue Apr 8, 2010 · 4 comments


None yet

4 participants

apollo13 commented Apr 8, 2010

looking at http://github.com/divio/django-cms/blob/master/cms/admin/pageadmin.py#L430 you are returning (if the user doesn't have the permissions) less inlines than you should. The add_view shows you the problem: http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/options.py#L783 if you remove Inlines from get_formsets zip won't be able to connect the Formset with the inline any longer; which might?! result in data loss (If you change the queryset method on the inline).

Prefered solution would be to get a get_formsets_with_inlines method into django 1.3 so we can return the correct formsets along with their inlines…

ojii commented Dec 22, 2010

closed because we can't reproduce or fully understand what the issue should be here

@ojii ojii reopened this Jun 13, 2011
ojii commented Jun 13, 2011

reopened, this could possibly cause issues, but unless someone actually reports an issue we'll keep this on very low priority.

svisser commented Jan 27, 2012

In the project that I'm working on, the cms.admin.pageadmin.PageAdmin class has been extended and an additional custom inline has been added to the list of inlines.

The above problem can indeed happen when the logged-in user is not allowed to change page permissions. This causes PagePermissionInlineAdmin to be dropped which means the variables self.inline_instances and formsets in the following line no longer have the same length:

for inline, formset in zip(self.inline_instances, formsets):

which is at django.contrib.admin.options.change_view . To be precise, the variables then have the following values:

self.inline_instances = [<cms.admin.permissionadmin.PagePermissionInlineAdmin object at 0x105289310>, <cmsext.admin.ExtraPageFieldsInline object at 0x1052893d0>]
formsets = [<django.forms.formsets.ExtraPageFieldsFormFormSet object at 0x105568490>]

The second inline / formset (i.e., our addition) should show up but in no longer does due to the fact that PagePermissionInlineAdmin has been dropped.

digi604 commented Jul 11, 2013

closed as we will follow a different path for extending page and titles models.

@digi604 digi604 closed this Jul 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment