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

« back to all changes in this revision

Viewing changes to tests/aggregation/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
# coding: utf-8
 
2
from django.db import models
 
3
from django.utils.encoding import python_2_unicode_compatible
 
4
 
 
5
 
 
6
@python_2_unicode_compatible
 
7
class Author(models.Model):
 
8
    name = models.CharField(max_length=100)
 
9
    age = models.IntegerField()
 
10
    friends = models.ManyToManyField('self', blank=True)
 
11
 
 
12
    def __str__(self):
 
13
        return self.name
 
14
 
 
15
@python_2_unicode_compatible
 
16
class Publisher(models.Model):
 
17
    name = models.CharField(max_length=255)
 
18
    num_awards = models.IntegerField()
 
19
 
 
20
    def __str__(self):
 
21
        return self.name
 
22
 
 
23
@python_2_unicode_compatible
 
24
class Book(models.Model):
 
25
    isbn = models.CharField(max_length=9)
 
26
    name = models.CharField(max_length=255)
 
27
    pages = models.IntegerField()
 
28
    rating = models.FloatField()
 
29
    price = models.DecimalField(decimal_places=2, max_digits=6)
 
30
    authors = models.ManyToManyField(Author)
 
31
    contact = models.ForeignKey(Author, related_name='book_contact_set')
 
32
    publisher = models.ForeignKey(Publisher)
 
33
    pubdate = models.DateField()
 
34
 
 
35
    def __str__(self):
 
36
        return self.name
 
37
 
 
38
@python_2_unicode_compatible
 
39
class Store(models.Model):
 
40
    name = models.CharField(max_length=255)
 
41
    books = models.ManyToManyField(Book)
 
42
    original_opening = models.DateTimeField()
 
43
    friday_night_closing = models.TimeField()
 
44
 
 
45
    def __str__(self):
 
46
        return self.name
 
47