~ubuntu-branches/ubuntu/saucy/python-django/saucy-updates

« back to all changes in this revision

Viewing changes to tests/modeltests/aggregation/models.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone, Jakub Wilk, Luke Faraone
  • Date: 2013-05-09 15:10:47 UTC
  • mfrom: (1.1.21) (4.4.27 sid)
  • Revision ID: package-import@ubuntu.com-20130509151047-aqv8d71oj9wvcv8c
Tags: 1.5.1-2
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Luke Faraone ]
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# coding: utf-8
2
2
from django.db import models
3
 
 
4
 
 
 
3
from django.utils.encoding import python_2_unicode_compatible
 
4
 
 
5
 
 
6
@python_2_unicode_compatible
5
7
class Author(models.Model):
6
8
    name = models.CharField(max_length=100)
7
9
    age = models.IntegerField()
8
10
    friends = models.ManyToManyField('self', blank=True)
9
11
 
10
 
    def __unicode__(self):
 
12
    def __str__(self):
11
13
        return self.name
12
14
 
 
15
@python_2_unicode_compatible
13
16
class Publisher(models.Model):
14
17
    name = models.CharField(max_length=255)
15
18
    num_awards = models.IntegerField()
16
19
 
17
 
    def __unicode__(self):
 
20
    def __str__(self):
18
21
        return self.name
19
22
 
 
23
@python_2_unicode_compatible
20
24
class Book(models.Model):
21
25
    isbn = models.CharField(max_length=9)
22
26
    name = models.CharField(max_length=255)
28
32
    publisher = models.ForeignKey(Publisher)
29
33
    pubdate = models.DateField()
30
34
 
31
 
    def __unicode__(self):
 
35
    def __str__(self):
32
36
        return self.name
33
37
 
 
38
@python_2_unicode_compatible
34
39
class Store(models.Model):
35
40
    name = models.CharField(max_length=255)
36
41
    books = models.ManyToManyField(Book)
37
42
    original_opening = models.DateTimeField()
38
43
    friday_night_closing = models.TimeField()
39
44
 
40
 
    def __unicode__(self):
 
45
    def __str__(self):
41
46
        return self.name
42
47