1 | # coding: utf-8
|
---|
2 | from django.db import models
|
---|
3 |
|
---|
4 | class Place(models.Model):
|
---|
5 | name = models.CharField(max_length=50)
|
---|
6 | address = models.CharField(max_length=80)
|
---|
7 |
|
---|
8 | class Restaurant(Place):
|
---|
9 | serves_hot_dogs = models.BooleanField()
|
---|
10 | serves_pizza = models.BooleanField()
|
---|
11 |
|
---|
12 | __test__ = {'API_TESTS': """
|
---|
13 | # #6755 regression test
|
---|
14 | >>> r = Restaurant(serves_pizza = False)
|
---|
15 | >>> r.save()
|
---|
16 | >>> r.id
|
---|
17 | 1
|
---|
18 | >>> r.place_ptr_id
|
---|
19 | 1
|
---|
20 | >>> r = Restaurant(place_ptr_id = 1, serves_pizza = True)
|
---|
21 | >>> r.save()
|
---|
22 | >>> r.id
|
---|
23 | 1
|
---|
24 | >>> r.place_ptr_id
|
---|
25 | 1
|
---|
26 |
|
---|
27 | """
|
---|
28 | }
|
---|