PageRenderTime 111ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 1ms

/tests/regressiontests/model_inheritance_select_related/models.py

https://code.google.com/p/mango-py/
Python | 29 lines | 17 code | 8 blank | 4 comment | 0 complexity | 568b49e569ae8a6320d2eb5af9630f92 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. """
  2. Regression tests for the interaction between model inheritance and
  3. select_related().
  4. """
  5. from django.db import models
  6. class Place(models.Model):
  7. name = models.CharField(max_length=50)
  8. class Meta:
  9. ordering = ('name',)
  10. def __unicode__(self):
  11. return u"%s the place" % self.name
  12. class Restaurant(Place):
  13. serves_sushi = models.BooleanField()
  14. serves_steak = models.BooleanField()
  15. def __unicode__(self):
  16. return u"%s the restaurant" % self.name
  17. class Person(models.Model):
  18. name = models.CharField(max_length=50)
  19. favorite_restaurant = models.ForeignKey(Restaurant)
  20. def __unicode__(self):
  21. return self.name