BertrandBordage / django-super-inlines

Adds useful features to inlines, such as the ability to nest them.
BSD 3-Clause "New" or "Revised" License
75 stars 8 forks source link

TypeError when calling _create_formsets() for Django < 1.7.2 #3

Closed neutr0nis closed 9 years ago

neutr0nis commented 9 years ago

Hello,

I noticed that when I visit the admin change view for a model instance with nested inlines under a Django version 1.7.1 or lower, I get the following error:

Environment:

Request Method: GET
Request URL: http://localhost:8000/admin/.../.../1/

Django Version: 1.7.1
Python Version: 2.7.6
Installed Applications:
[u'super_inlines',
 u'django.contrib.admin',
 u'django.contrib.auth',
 u'django.contrib.contenttypes',
 u'django.contrib.staticfiles',
 u'django.contrib.sites',
 u'django.contrib.sessions',
 u'subdomains']

Installed Middleware:
(u'django.contrib.sessions.middleware.SessionMiddleware',
 u'subdomains.middleware.SubdomainURLRoutingMiddleware',
 u'django.middleware.common.CommonMiddleware',
 u'django.middleware.csrf.CsrfViewMiddleware',
 u'django.contrib.auth.middleware.AuthenticationMiddleware',
 u'django.contrib.messages.middleware.MessageMiddleware')

Traceback:
File "/.../virtualenv/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/.../virtualenv/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
  584.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/.../virtualenv/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  105.                     response = view_func(request, *args, **kwargs)
File "/.../virtualenv/local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  52.         response = view_func(request, *args, **kwargs)
File "/.../virtualenv/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
  204.             return view(request, *args, **kwargs)
File "/.../virtualenv/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in change_view
  1457.         return self.changeform_view(request, object_id, form_url, extra_context)
File "/.../virtualenv/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
  29.             return bound_func(*args, **kwargs)
File "/.../virtualenv/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  105.                     response = view_func(request, *args, **kwargs)
File "/.../virtualenv/local/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
  25.                 return func.__get__(self, type(self))(*args2, **kwargs2)
File "/.../virtualenv/local/lib/python2.7/site-packages/django/db/transaction.py" in inner
  394.                 return func(*args, **kwargs)
File "/.../virtualenv/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in changeform_view
  1421.                 formsets, inline_instances = self._create_formsets(request, obj)

Exception Type: TypeError at /admin/.../.../1/
Exception Value: _create_formsets() takes exactly 4 arguments (3 given)

The problem disappears if I use Django version 1.7.2 or higher. I have django-super-inlines 0.1.3.

BertrandBordage commented 9 years ago

That’s right, I forgot to mention that in the readme and in the requirements. Fixed with c143426807427aa0c37d0977ac69666fd6bb5f85.