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

Nested inlines not displaying #41

Open
christianpbrink opened this issue Jun 12, 2014 · 3 comments
Open

Nested inlines not displaying #41

christianpbrink opened this issue Jun 12, 2014 · 3 comments

Comments

@christianpbrink
Copy link

I've just installed django-client-admin per the README instructions. It works on a basic level -- it's taken over rendering my admin pages, with proper styling and everything. However, it won't display nested inline menus at all.

Not only can I not see the nested inline, but I can't submit the admin form without getting a ValidationError ([u'ManagementForm data is missing or has been tampered with']). Some excerpts from the stacktrace:

/Users/cbrink/.virtualenvs/cci/lib/python2.6/site-packages/client_admin/admin.py in change_view
                self.add_recursive_inline_formsets(request, inline, formset, obj) ...

/Users/cbrink/.virtualenvs/cci/lib/python2.6/site-packages/client_admin/admin.py in add_recursive_inline_formsets
                        self.add_recursive_inline_formsets(request, recursive_inline, recursive_formset) ...

/Users/cbrink/.virtualenvs/cci/lib/python2.6/site-packages/client_admin/admin.py in add_recursive_inline_formsets
    for form in formset.forms: ...

Has anyone else run into similar behavior?

Here's my settings.INSTALLED_APPS:

INSTALLED_APPS = ( 'django.contrib.auth'
                 , 'django.contrib.contenttypes'
                 , 'django.contrib.sessions'
                 , 'django.contrib.sites'
                 , 'django.contrib.messages'
                 , 'django.contrib.staticfiles'
                 , 'client_admin'
                 , 'django.contrib.admin'
                 , 'django.contrib.admindocs'
                 , 'south'
                 , 'myapp'
                 )

The relevant slice of urls.urlpatterns:

url(r'^admin/', include('client_admin.urls')),
url(r'^admin/', include(admin.site.urls)),

The relevant bits of myapp.admin:

from client_admin.admin import ClientModelAdmin \
                             , GroupedInline    \
                             , TabularInline    \
                             , StackedInline

class MySecondLevelInline(TabularInline):
    model = MySecondLevelModel

class MyFirstLevelInline(StackedInline):
    model = MyFirstLevelModel
    inlines = [MySecondLevelInline]

class MyAdmin(ClientModelAdmin):
    inlines = [MyFirstLevelInline]

I've tried all combinations of StackedInline and TabularInline; all fail the same way.

I've tried manually creating an instance of the nested inline's model, hoping that would force it to render the nested formset -- I could more easily start debugging this if I could see it work properly in one scenario. But no luck.

@krimkus
Copy link
Contributor

krimkus commented Jun 12, 2014

Hi @christianpbrink, sorry to hear about your issue. Could you tell me what versions of Django and Client Admin you are using?

@christianpbrink
Copy link
Author

Thanks for replying so fast. Django 1.6.5, django-client-admin 1.1.0

On Thu, Jun 12, 2014 at 2:24 PM, Kyle Rimkus [email protected]
wrote:

Hi @christianpbrink https://github.com/christianpbrink, sorry to hear
about your issue. Could you tell me what versions of Django and Client
Admin you are using?


Reply to this email directly or view it on GitHub
#41 (comment)
.

@krimkus
Copy link
Contributor

krimkus commented Jun 12, 2014

Thanks for the info. I suspect that this bug is caused by some changes in Django 1.6+ inlines.js code. The missing management form probably means that the javascript is not properly copying and replacing ids when it duplicates the hidden inline fieldsets. I will go through the overridden file to see if anything needs to be updated, but I won't be able to get to it today.

The relevant javascript logic is here in case you are curious:
https://github.com/concentricsky/django-client-admin/commits/master/client_admin/static/admin/js/inlines.js

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