On 8/8/06, Alan Green <[EMAIL PROTECTED]> wrote:

Hi Bjørn,

Sure. In this case you would need a discriminator attribute on Place.
I'm thinking of code along the lines of:

class Place(models.Model):
    ...
    discriminator = models.CharField(maxlength=50)
    def save(self):
        self.discriminator = self.__class__.__name__.lower()
        models.Model.save(self)

    def autocast(self):
        return self.getattr(self.discriminator)

For those late to the discussion, it should be noted that this was one of the ideas proposed for implementing inheritance. It was rejected on two grounds:

1) Lack of support for legacy databases
2) The number of joins that would be required for queries in the general case.

However, while it isn't a viable solution as part of Django's model system, as Alan notes, you can implement the same behaviour yourself.

Yours,
Russ Magee %-)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django developers" 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/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to