Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[bug] get_formsets may not drop inlines #418

Closed
apollo13 opened this Issue · 4 comments

4 participants

@apollo13

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
Collaborator

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

@ojii ojii reopened this
@ojii
Collaborator

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

@svisser

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
Collaborator

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

@digi604 digi604 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.