App Engine Python SDK version 1.7.4 (2)
[gae.git] / python / lib / django_1_4 / tests / modeltests / aggregation / models.py
blobccc12898b79e41b8b9922533ba06472c1bd60cd8
1 # coding: utf-8
2 from django.db import models
5 class Author(models.Model):
6 name = models.CharField(max_length=100)
7 age = models.IntegerField()
8 friends = models.ManyToManyField('self', blank=True)
10 def __unicode__(self):
11 return self.name
13 class Publisher(models.Model):
14 name = models.CharField(max_length=255)
15 num_awards = models.IntegerField()
17 def __unicode__(self):
18 return self.name
20 class Book(models.Model):
21 isbn = models.CharField(max_length=9)
22 name = models.CharField(max_length=255)
23 pages = models.IntegerField()
24 rating = models.FloatField()
25 price = models.DecimalField(decimal_places=2, max_digits=6)
26 authors = models.ManyToManyField(Author)
27 contact = models.ForeignKey(Author, related_name='book_contact_set')
28 publisher = models.ForeignKey(Publisher)
29 pubdate = models.DateField()
31 def __unicode__(self):
32 return self.name
34 class Store(models.Model):
35 name = models.CharField(max_length=255)
36 books = models.ManyToManyField(Book)
37 original_opening = models.DateTimeField()
38 friday_night_closing = models.TimeField()
40 def __unicode__(self):
41 return self.name