On Sun, 2006-10-08 at 14:52 -0700, Panos Laganakos wrote:
> > Try using the same pattern you' ve used with the Dvd class with the
> > inner Admin class,
> > like this:
> >
> > class Dvd(models.Model):
> >      pass
> >
> >      class Admin:
> >           pass
> >
> > That should solve both problems (that really are of the same issue, when
> > an admin view has been activated/defined for a model, the green plus
> > shortcut appears nesides the FK field area in the admin views of the models
> > related to it).
> 
> Indeed Ramiro, that did the trick, thanks alot. What seems strange to
> me, is that when I try to add a Dvd object, I get a "list index out of
> range", which I don't see why happens.

There are a few corner cases for objects that only have an implicit
primary key field like this. Working with them in the admin interface is
one of the areas that may or may not work. It's not really worth us
putting in an enormous amount of time to get all of this ironed out,
since you can trivially get the same effect using an explicit primary
key (just define the primary_key attribute on a field) and then
everything should work smoothly. Or you can just fold the empty model
into one of the classes it's used in and get rid of it altogether, since
it's isomorphic to having an integer field where the ForeignKey
currently is.

Models with only an implicit id field are permitted in Django. It is
possible to do everything without using them, but we support them
because it's convenient for some people to work that way. However, it
doesn't really make a lot of sense to use them in the admin that I can
see -- best to think of it as the admin interface working with
explicitly defined fields only; there is nothing to admin if you don't
explicitly declare a field.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to