~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

Viewing changes to tests/datetimes/models.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone
  • Date: 2013-11-07 15:33:49 UTC
  • mfrom: (1.3.12)
  • Revision ID: package-import@ubuntu.com-20131107153349-e31sc149l2szs3jb
Tags: 1.6-1
* New upstream version. Closes: #557474, #724637.
* python-django now also suggests the installation of ipython,
  bpython, python-django-doc, and libgdal1.
  Closes: #636511, #686333, #704203
* Set package maintainer to Debian Python Modules Team.
* Bump standards version to 3.9.5, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from __future__ import unicode_literals
 
2
 
 
3
from django.db import models
 
4
from django.utils.encoding import python_2_unicode_compatible
 
5
 
 
6
 
 
7
@python_2_unicode_compatible
 
8
class Article(models.Model):
 
9
    title = models.CharField(max_length=100)
 
10
    pub_date = models.DateTimeField()
 
11
 
 
12
    categories = models.ManyToManyField("Category", related_name="articles")
 
13
 
 
14
    def __str__(self):
 
15
        return self.title
 
16
 
 
17
@python_2_unicode_compatible
 
18
class Comment(models.Model):
 
19
    article = models.ForeignKey(Article, related_name="comments")
 
20
    text = models.TextField()
 
21
    pub_date = models.DateTimeField()
 
22
    approval_date = models.DateTimeField(null=True)
 
23
 
 
24
    def __str__(self):
 
25
        return 'Comment to %s (%s)' % (self.article.title, self.pub_date)
 
26
 
 
27
class Category(models.Model):
 
28
    name = models.CharField(max_length=255)