2008-07-23 18:58:06 +00:00
|
|
|
"""
|
|
|
|
Tests for various ways of registering models with the admin site.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from django.db import models
|
|
|
|
|
2011-10-13 18:51:33 +00:00
|
|
|
|
2008-07-23 18:58:06 +00:00
|
|
|
class Person(models.Model):
|
|
|
|
name = models.CharField(max_length=200)
|
|
|
|
|
2012-12-18 00:04:10 +00:00
|
|
|
|
|
|
|
class Traveler(Person):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2011-02-23 13:43:21 +00:00
|
|
|
class Location(models.Model):
|
|
|
|
class Meta:
|
|
|
|
abstract = True
|
|
|
|
|
2012-12-18 00:04:10 +00:00
|
|
|
|
2011-02-23 13:43:21 +00:00
|
|
|
class Place(Location):
|
2008-07-23 18:58:06 +00:00
|
|
|
name = models.CharField(max_length=200)
|
2024-04-07 02:32:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Guest(models.Model):
|
|
|
|
pk = models.CompositePrimaryKey("traveler", "place")
|
|
|
|
traveler = models.ForeignKey(Traveler, on_delete=models.CASCADE)
|
|
|
|
place = models.ForeignKey(Place, on_delete=models.CASCADE)
|