Hello Marc, from which module you call that admin.site.register? admin.site.register(Xyz, XyzOptions) It should be done in admin.py in which is defined XyzOptions. It is in the same directory, where is class Xyz in models.py. This reliably eliminates dependencies from admin to any unloaded model.
I see, that the crash is before all models are loaded. This is trivial. Django tries to load all models.py and then admin.py. Also no instance of admin.ModelAdmin is created, before all models.Model are inicialized. This minimizes chicken and egg problem. :-) (How to get some parameters from the database (livesettings) before database models are initialized.) Impossible, but there are some methods to circumvent it. If it does not helps, be more concrete about dependencies in shipping module. Hynek On Mar 1, 4:44 pm, "Dierckx, Marc" <[email protected]> wrote: > Hello, > > when I try to import a model into the shipper.py of a custom shipping module > the system crashes when the model file contains a admin.site.register > (registering the model in the admin) . The error dispappears when I eliminate > admin.site.register from the models.py > > regards, > > marc > > I get following error messages : > > Request Method: GET > Request URL: http://localhost:8000/settings/ > Django Version: 1.2.3 > Exception Type: AttributeError > Exception Value: > 'NoneType' object has no attribute 'objects' > > /usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py in > get_response > response = callback(request, *callback_args, > **callback_kwargs) ... > ? Local vars > /usr/local/lib/python2.6/dist-packages/django_livesettings-1.4_4-py2.6.egg/livesettings/views.py > in site_settings > return group_settings(request, group=None, > template='livesettings/site_settings.html') ... > ? Local vars > /usr/local/lib/python2.6/dist-packages/django/views/decorators/cache.py in > _wrapped_view_func > response = view_func(request, *args, **kwargs) ... > ? Local vars > /usr/local/lib/python2.6/dist-packages/django/contrib/admin/views/decorators.py > in _checklogin > return view_func(request, *args, **kwargs) ... > ? Local vars > /usr/local/lib/python2.6/dist-packages/django_livesettings-1.4_4-py2.6.egg/livesettings/views.py > in group_settings > }, context_instance=RequestContext(request)) ... > ? Local vars > /usr/local/lib/python2.6/dist-packages/django/template/context.py in __init__ > self.update(processor(request)) ... > ? Local vars > /usr/local/lib/python2.6/dist-packages/Satchmo-0.9_2-py2.6.egg/satchmo_store/shop/context_processors.py > in settings > shop_config = Config.objects.get_current() ... > ? Local vars > /usr/local/lib/python2.6/dist-packages/Satchmo-0.9_2-py2.6.egg/satchmo_store/shop/models.py > in get_current > site = Site.objects.get_current() -- You received this message because you are subscribed to the Google Groups "Satchmo users" 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/satchmo-users?hl=en.
