On 7/15/06, webd0012 <[EMAIL PROTECTED]> wrote:
> Also, I want to have more than one type of place.  Is subclasses the
> right way to do this?  I tried (for "Park" as shown below), but get an
> error in the admin that says "'Place' object has no attribute
> 'has_benches'".

Model subclassing is under an ongoing heavy refactoring, and doesn't
reliably work. If I were setting it up, what I'd do is something like

class Place(models.Model):
    ...stuff here that's shared by all types of places...

class City(models.Model):
    ...stuff here that's specific to cities...
    place = models.OneToOneField(Place)

class Park(models.Model):
    ....stuff here that's specific to parks...
    place = models.OneToOneField(Place)

And so on.

There is a note in the docs about one-to-one relationships, but it's
safe to ignore; that's more related to the work on subclassing (once
it's done, a lot of things that one-to-one fields are used for will
hopefully be accomplished more effectively by subclassing) than to any
problems with OneToOneField.

As for the sections stuff, what I'd do is create a CitySection model,
and give each Place a ForeignKey to a CitySection.

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~---------~--~----~------------~-------~--~----~
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