PageRenderTime 37ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/regressiontests/dates/models.py

https://code.google.com/p/mango-py/
Python | 23 lines | 16 code | 7 blank | 0 comment | 0 complexity | 5dd7e2e13c6a38b7ebfea4160502f372 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. from django.db import models
  2. class Article(models.Model):
  3. title = models.CharField(max_length=100)
  4. pub_date = models.DateField()
  5. categories = models.ManyToManyField("Category", related_name="articles")
  6. def __unicode__(self):
  7. return self.title
  8. class Comment(models.Model):
  9. article = models.ForeignKey(Article, related_name="comments")
  10. text = models.TextField()
  11. pub_date = models.DateField()
  12. approval_date = models.DateField(null=True)
  13. def __unicode__(self):
  14. return 'Comment to %s (%s)' % (self.article.title, self.pub_date)
  15. class Category(models.Model):
  16. name = models.CharField(max_length=255)