That makes sense.  I'll just create a different admin for each model.

Thanks.

On Feb 10, 4:36 am, Karen Tracey <kmtra...@gmail.com> wrote:
> On Mon, Feb 9, 2009 at 5:18 PM, phoebebright <phoebebright...@gmail.com>wrote:
>
>
>
>
>
> > Yes I see that, it's just if I don't put the custom form in it works
> > fine:
>
> > class DirectoryAdmin(admin.ModelAdmin):
>
> >    fieldsets = [
> >        (None,   {'fields': ['cat','name','is_live']}),    <--------
> > CAT FIELD STILL HERE AN OK
> >         ('Contact', {'fields':
> > ['phone','mobile','fax','email','web','address']}),
> >        ('Details', {'fields':
> > ['description','pic1','pic2','pic3','pic4']}),
> >    ]
>
> > admin.site.register(Business,DirectoryAdmin)
>
> I've not looked at the admin code here to determine when it does what,
> exactly, but just looking at the defs I can see what I expect is going on,
> and it makes sense,  For this case, your DirectoryAdmin isn't tied a a
> particular model until the admin.site.register, where you tie it to the
> Business model, which has the cat field, so all in OK.  In your other case,
> you had a custom form with a class Meta specifying model=Directory, which
> does not have a cat field.  So your custom form does not have the field you
> are trying to list in fieldsets.
>
> There is no error in this case here because you don't do anything to tie
> DirectoryAdmin to the Directory model instead of the Business model, whereas
> in the error case you tie DirectoryAdmin to the Directory model, which does
> not have the cat field, so you get an error.
>
> Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to