Debian Codegraph @

tests/admin_registration/models.py

raw
1 """
2 Tests for various ways of registering models with the admin site.
3 """
4
5 from django.db import models
6
7
8 class Person(models.Model):
9 name = models.CharField(max_length=200)
10
11
12 class Traveler(Person):
13 pass
14
15
16 class Location(models.Model):
17 class Meta:
18 abstract = True
19
20
21 class Place(Location):
22 name = models.CharField(max_length=200)
23
24
25 class Guest(models.Model):
26 pk = models.CompositePrimaryKey("traveler", "place")
27 traveler = models.ForeignKey(Traveler, on_delete=models.CASCADE)
28 place = models.ForeignKey(Place, on_delete=models.CASCADE)