PageRenderTime 36ms CodeModel.GetById 31ms app.highlight 3ms 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
 1from django.db import models
 2
 3
 4class Article(models.Model):
 5    title = models.CharField(max_length=100)
 6    pub_date = models.DateField()
 7
 8    categories = models.ManyToManyField("Category", related_name="articles")
 9
10    def __unicode__(self):
11        return self.title
12
13class Comment(models.Model):
14    article = models.ForeignKey(Article, related_name="comments")
15    text = models.TextField()
16    pub_date = models.DateField()
17    approval_date = models.DateField(null=True)
18
19    def __unicode__(self):
20        return 'Comment to %s (%s)' % (self.article.title, self.pub_date)
21
22class Category(models.Model):
23    name = models.CharField(max_length=255)