equal
deleted
inserted
replaced
|
1 from django.db import models |
|
2 |
|
3 class Square(models.Model): |
|
4 root = models.IntegerField() |
|
5 square = models.PositiveIntegerField() |
|
6 |
|
7 def __unicode__(self): |
|
8 return "%s ** 2 == %s" % (self.root, self.square) |
|
9 |
|
10 class Person(models.Model): |
|
11 first_name = models.CharField(max_length=20) |
|
12 last_name = models.CharField(max_length=20) |
|
13 |
|
14 def __unicode__(self): |
|
15 return u'%s %s' % (self.first_name, self.last_name) |
|
16 |
|
17 class SchoolClass(models.Model): |
|
18 year = models.PositiveIntegerField() |
|
19 day = models.CharField(max_length=9, blank=True) |
|
20 last_updated = models.DateTimeField() |
|
21 |
|
22 |
|
23 class Reporter(models.Model): |
|
24 first_name = models.CharField(max_length=30) |
|
25 last_name = models.CharField(max_length=30) |
|
26 |
|
27 def __unicode__(self): |
|
28 return u"%s %s" % (self.first_name, self.last_name) |
|
29 |
|
30 |
|
31 class Article(models.Model): |
|
32 headline = models.CharField(max_length=100) |
|
33 pub_date = models.DateField() |
|
34 reporter = models.ForeignKey(Reporter) |
|
35 |
|
36 def __unicode__(self): |
|
37 return self.headline |