PageRenderTime 34ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/regressiontests/string_lookup/models.py

https://code.google.com/p/mango-py/
Python | 45 lines | 32 code | 12 blank | 1 comment | 0 complexity | db8e2b6d6757576557ca18276eaf2a65 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. # -*- coding: utf-8 -*-
  2. from django.db import models
  3. class Foo(models.Model):
  4. name = models.CharField(max_length=50)
  5. friend = models.CharField(max_length=50, blank=True)
  6. def __unicode__(self):
  7. return "Foo %s" % self.name
  8. class Bar(models.Model):
  9. name = models.CharField(max_length=50)
  10. normal = models.ForeignKey(Foo, related_name='normal_foo')
  11. fwd = models.ForeignKey("Whiz")
  12. back = models.ForeignKey("Foo")
  13. def __unicode__(self):
  14. return "Bar %s" % self.place.name
  15. class Whiz(models.Model):
  16. name = models.CharField(max_length=50)
  17. def __unicode__(self):
  18. return "Whiz %s" % self.name
  19. class Child(models.Model):
  20. parent = models.OneToOneField('Base')
  21. name = models.CharField(max_length=50)
  22. def __unicode__(self):
  23. return "Child %s" % self.name
  24. class Base(models.Model):
  25. name = models.CharField(max_length=50)
  26. def __unicode__(self):
  27. return "Base %s" % self.name
  28. class Article(models.Model):
  29. name = models.CharField(max_length=50)
  30. text = models.TextField()
  31. submitted_from = models.IPAddressField(blank=True, null=True)
  32. def __str__(self):
  33. return "Article %s" % self.name