Given the following:
class Place(models.Model):
name = models.CharField(max_length=50)
address = models.CharField(max_length=80)
zip_code = models.CharField(max_length=15)
class Restaurant(Place):
serves_hot_dogs = models.BooleanField()
serves_pizza = models.BooleanField()
c
> Given the following:
>
> class Place(models.Model):
> name = models.CharField(max_length=50)
> address = models.CharField(max_length=80)
> zip_code = models.CharField(max_length=15)
>
>
> class Restaurant(Place):
> serves_hot_dogs = models.BooleanField()
> serves_pizza = mo
On Tue, May 18, 2010 at 4:27 AM, Jani Tiainen wrote:
> > Given the following:
> >
> > class Place(models.Model):
> > name = models.CharField(max_length=50)
> > address = models.CharField(max_length=80)
> > zip_code = models.CharField(max_length=15)
> >
> >
> > class Restaurant(Place):
http://docs.djangoproject.com/en/1.2/topics/db/models/#id7
You can access sub-classes with place.restaurant and place.gardenstore
if the model has them.
I did something similar the other day but added an extra field to
parent class to indicate which type of a child model it had (1 for
Restaurant
4 matches
Mail list logo