#26816: BaseModelAdminChecks._check_inlines_item may raise AttributeError
-------------------------------------+-------------------------------------
     Reporter:  kezabelle            |                    Owner:
                                     |  berkerpeksag
         Type:  Bug                  |                   Status:  assigned
    Component:  Core (System         |                  Version:  1.9
  checks)                            |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by berkerpeksag):

 * owner:  nobody => berkerpeksag
 * status:  new => assigned
 * has_patch:  0 => 1
 * cc: berker.peksag@… (added)


Comment:

 For future reference, here is the full traceback when `BaseModelAdmin` is
 used as a base class (see comment 2 for full example):

 {{{
 Unhandled exception in thread started by <function wrapper at 0x2f98668>
 Traceback (most recent call last):
   File "/home/berker/projects/django/django/utils/autoreload.py", line
 226, in wrapper
     fn(*args, **kwargs)
   File
 "/home/berker/projects/django/django/core/management/commands/runserver.py",
 line 113, in inner_run
     autoreload.raise_last_exception()
   File "/home/berker/projects/django/django/utils/autoreload.py", line
 249, in raise_last_exception
     six.reraise(*_exception)
   File "/home/berker/projects/django/django/utils/autoreload.py", line
 226, in wrapper
     fn(*args, **kwargs)
   File "/home/berker/projects/django/django/__init__.py", line 27, in
 setup
     apps.populate(settings.INSTALLED_APPS)
   File "/home/berker/projects/django/django/apps/registry.py", line 115,
 in populate
     app_config.ready()
   File "/home/berker/projects/django/django/contrib/admin/apps.py", line
 23, in ready
     self.module.autodiscover()
   File "/home/berker/projects/django/django/contrib/admin/__init__.py",
 line 26, in autodiscover
     autodiscover_modules('admin', register_to=site)
   File "/home/berker/projects/django/django/utils/module_loading.py", line
 50, in autodiscover_modules
     import_module('%s.%s' % (app_config.name, module_to_search))
   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in
 import_module
     __import__(name)
   File "/home/berker/projects/testdjango/core/admin.py", line 38, in
 <module>
     site.register(SlugModel, SlugAdmin)
   File "/home/berker/projects/django/django/contrib/admin/sites.py", line
 110, in register
     system_check_errors.extend(admin_obj.check())
   File "/home/berker/projects/django/django/contrib/admin/options.py",
 line 117, in check
     return self.checks_class().check(self, **kwargs)
   File "/home/berker/projects/django/django/contrib/admin/checks.py", line
 519, in check
     errors.extend(self._check_inlines(admin_obj))
   File "/home/berker/projects/django/django/contrib/admin/checks.py", line
 557, in _check_inlines
     for index, item in enumerate(obj.inlines)
   File "/home/berker/projects/django/django/contrib/admin/checks.py", line
 585, in _check_inlines_item
     return inline(model, obj.admin_site).check()
 TypeError: __init__() takes exactly 1 argument (3 given)
 }}}

 [https://github.com/django/django/pull/7149 PR]. `test_not_model_admin`
 and `test_missing_model_field` in `tests/modeladmin/tests.py` already
 tested the behaviors demonstrated by kezabelle.

--
Ticket URL: <https://code.djangoproject.com/ticket/26816#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.7017524c4470575f7ddc3444f7a3ea7f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to