#10249: Cannot create a consistent method resolution order (MRO) for bases
FieldFile, File
---------------------------------------------------+------------------------
          Reporter:  kmtracey                      |         Owner:  mitsuhiko
            Status:  closed                        |     Milestone:  1.1      
         Component:  Database layer (models, ORM)  |       Version:  1.2-beta 
        Resolution:  fixed                         |      Keywords:           
             Stage:  Accepted                      |     Has_patch:  0        
        Needs_docs:  0                             |   Needs_tests:  0        
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Changes (by Marcelo_MV):

 * cc: [email protected] (removed)
 * cc: [email protected] (added)
  * version:  1.0 => 1.2-beta
  * component:  File uploads/storage => Database layer (models, ORM)

Comment:

 Hello everyone,

 I was looking on google about this error and I found this tracker. Today,
 I also tried to use multiple inheritance with a class used as a main class
 for my Django admin classes. In my case I used djago-reversion package
 (http://wiki.github.com/etianen/django-reversion/low-level-api) class
 VersionAdmin? as the second class in the inheritance line. The code is as
 follows:

 class MuchTourModelAdmin?(admin.ModelAdmin?, VersionAdmin?):

     #class body

 However, after restarting the django runserver and trying to access my
 site I got the following trace:

 Traceback (most recent call last):

     File "C:\Python25\Lib\site-packages\django\core\servers\basehttp.py",
 line 674, in call

         return self.application(environ, start_response)

     File "C:\Python25\Lib\site-packages\django\core\handlers\wsgi.py",
 line 241, in call

         response = self.get_response(request)

     File "C:\Python25\Lib\site-packages\django\core\handlers\base.py",
 line 142, in get_response

         return self.handle_uncaught_exception(request, resolver, exc_info)

     File "C:\Python25\Lib\site-packages\django\core\handlers\base.py",
 line 166, in handle_uncaught_exception

         return debug.technical_500_response(request, *exc_info)

     File "C:\Python25\Lib\site-packages\django\core\handlers\base.py",
 line 80, in get_response

         response = middleware_method(request)

     File "C:\Python25\Lib\site-packages\django\middleware\common.py", line
 57, in process_request

         if (not _is_valid_path(request.path_info, urlconf) and

     File "C:\Python25\Lib\site-packages\django\middleware\common.py", line
 143, in _is_valid_path

         urlresolvers.resolve(path, urlconf)

     File "C:\Python25\Lib\site-packages\django\core\urlresolvers.py", line
 301, in resolve

         return get_resolver(urlconf).resolve(path)

     File "C:\Python25\Lib\site-packages\django\core\urlresolvers.py", line
 214, in resolve

         for pattern in self.url_patterns:

     File "C:\Python25\Lib\site-packages\django\core\urlresolvers.py", line
 243, in _get_url_patterns

         patterns = getattr(self.urlconf_module, "urlpatterns",
 self.urlconf_module)

     File "C:\Python25\Lib\site-packages\django\core\urlresolvers.py", line
 238, in _get_urlconf_module

         self._urlconf_module = import_module(self.urlconf_name)

     File "C:\Python25\Lib\site-packages\django\utils\importlib.py", line
 35, in import_module

         import(name)

     File "C:\doisxt\muchtour\djsite\urls.py", line 18, in <module>

         admin.autodiscover()

     File "C:\Python25\Lib\site-packages\django\contrib\admin\init.py",
 line 24, in autodiscover

         import_module('%s.admin' % app)

     File "C:\Python25\Lib\site-packages\django\utils\importlib.py", line
 35, in import_module

         import(name)

     File "C:\doisxt\muchtour\djsite\admin\cidade\admin.py", line 13, in
 <module>

         from djsite.util.admin import MuchTourModelAdmin?

     File "C:\doisxt\muchtour\djsite\util\admin.py", line 48, in <module>

         class MuchTourModelAdmin?(admin.ModelAdmin?, VersionAdmin?):

     File "C:\Python25\Lib\site-packages\django\forms\widgets.py", line
 127, in new

         attrs)

 TypeError?: Error when calling the metaclass bases

     Cannot create a consistent method resolution

 order (MRO) for bases ModelAdmin?, VersionAdmin?

 If I change the order of the inheritance line it works fine, even though I
 haven't tested the whole system:

 class MuchTourModelAdmin?(VersionAdmin?, admin.ModelAdmin?):

     #class body

 Django version: Django version 1.2.1 SVN-202

 Perhaps I didn't pay enought attention in some subject discussed above. Is
 there anything I should do? I'm a bit concerned about the possibility that
 this error could arise again, even changing the inheritance order.

 Thanks to all. Regards.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10249#comment:9>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to