On Mon, Aug 16, 2010 at 5:48 PM, Jerry Stratton <goo...@hoboes.com> wrote:
> I have this in my admin.py: > > > class TutorialAdmin(admin.ModelAdmin): > fields = ( > ('title', 'category'), > 'description', > 'tags' > ) > admin.site.register(Tutorial, TutorialAdmin) > > It works fine when DEBUG = False in settings.py, but it fails when > DEBUG = True. > > ImproperlyConfigured at /admin/tutorials/tutorial/ > 'TutorialAdmin.fields' refers to field '('title', 'category')' that is > missing from the form. > > I've switched to using the more complicated fieldsets for now; but it > seems odd that this syntax for 'fields' fails only when DEBUG is on. > Admin definitions are only explicitly validated when DEBUG is on. That is, when DEBUG is on, there is some extensive checking of the admin definitions to make sure that they all make sense and are valid. This is only done when DEBUG is on because it is fairly expensive and thus not something you necessarily want to do during production server start-up, when you likely have not changed your admin definitions anyway so validating them is likely wasted effort. So yes, the ImproperlyConfigured error is something you will only get with DEBUG on. But I would expect that the effect of the problem it identified would be seen at some point when you try using the admin with DEBUG off. That is, I'd expect you to hit some (possibly pretty cryptic) error at some point, or find that not all the fields you are expecting are actually listed, or something like that. Karen -- http://tracey.org/kmt/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.