Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#14670 closed (fixed)

GenericTabularInline broken as of r13708

Reported by: seanbrant Owned by: gregmuellegger
Component: Contrib apps Version: master
Severity: Keywords: sprintnov13
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Using GenericTabularLine seem to have a regression as of r13708. I get the following 'NoneType' object has no attribute 'user' using r13708 and no error using r13707. Line 292 of is throwing the error return request.user.has_perm(opts.app_label + '.' + opts.get_add_permission()) because request is None. Sorry I don't have a patch Im not real clear on what is going on in the code. As a side note im just using a barebones GenericTabularLine and ModelAdmin.

Attachments (1)

issue14670.1.diff (3.9 KB) - added by gregmuellegger 5 years ago.
Adding test suite and fix for the issue.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 5 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

(Please include tracebacks in reports like this.)

Traceback pulled from dpaste (it was referenced in IRC):


Request Method: GET
Request URL:
Django Version: 1.3 alpha 1
Python Version: 2.6.1
Installed Applications:
Installed Middleware:

File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/core/handlers/" in get_response
  109.                         response = callback(request, *callback_args, **callback_kwargs)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/contrib/admin/" in wrapper
  245.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/utils/" in _wrapped_view
  89.                     response = view_func(request, *args, **kwargs)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/views/decorators/" in _wrapped_view_func
  78.         response = view_func(request, *args, **kwargs)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/contrib/admin/" in inner
  191.             return view(request, *args, **kwargs)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/utils/" in _wrapper
  24.             return bound_func(*args, **kwargs)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/utils/" in _wrapped_view
  89.                     response = view_func(request, *args, **kwargs)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/utils/" in bound_func
  20.                 return func(self, *args2, **kwargs2)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/db/" in inner
  291.                 res = func(*args, **kwargs)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/contrib/admin/" in add_view
  821.                                        self.inline_instances):
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/contrib/admin/" in get_formsets
  421.             yield inline.get_formset(request, obj)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/contrib/contenttypes/" in get_formset
  419.         return generic_inlineformset_factory(self.model, **defaults)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/contrib/contenttypes/" in generic_inlineformset_factory
  385.                                    fields=fields, exclude=exclude, max_num=max_num)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/forms/" in modelformset_factory
  684.                              formfield_callback=formfield_callback)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/forms/" in modelform_factory
  423.     return ModelFormMetaclass(class_name, (form,), form_class_attrs)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/forms/" in __new__
  227.                                       opts.exclude, opts.widgets, formfield_callback)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/forms/" in fields_for_model
  185.             formfield = formfield_callback(f, **kwargs)
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/contrib/admin/" in formfield_for_dbfield
  113.                             related_modeladmin.has_add_permission(request))
File "/Users/seanbrant/Environments/stash/lib/python2.6/site-packages/django/contrib/admin/" in has_add_permission
  292.         return request.user.has_perm(opts.app_label + '.' + opts.get_add_permission())

Exception Type: AttributeError at /super-admin/blogs/blog/add/
Exception Value: 'NoneType' object has no attribute 'user'

comment:2 Changed 5 years ago by gregmuellegger

  • Keywords sprintnov13 added
  • Owner changed from nobody to gregmuellegger
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 5 years ago by gregmuellegger

Seems to me like r13708 introduced this error. But it's not obvious why yet. I will look into in detail later.

Changed 5 years ago by gregmuellegger

Adding test suite and fix for the issue.

comment:4 Changed 5 years ago by gregmuellegger

  • Has patch set
  • Triage Stage changed from Accepted to Ready for checkin

Sorry for my previous embarrassing comment. I should have read the title of the ticket and looked at the specific revision in more detail.

However it's fixed now. Fix and tests are attached in the patch.

comment:5 Changed 5 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [14555]) Fixed #14670 -- Made GenericTabularInline aware of changes made in r13708. Thanks, gregmuellegger.

comment:6 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top