2012-05-24 19:25:01 +08:00
|
|
|
"""
|
|
|
|
Existing related object instance caching.
|
|
|
|
|
|
|
|
Test that queries are not redone when going back through known relations.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from django.db import models
|
|
|
|
|
2013-11-03 12:36:09 +08:00
|
|
|
|
2012-05-24 19:25:01 +08:00
|
|
|
class Tournament(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
|
|
|
|
2013-11-03 12:36:09 +08:00
|
|
|
|
2013-01-03 04:42:52 +08:00
|
|
|
class Organiser(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
|
|
|
|
2013-11-03 12:36:09 +08:00
|
|
|
|
2012-05-24 19:25:01 +08:00
|
|
|
class Pool(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
2015-07-22 22:43:21 +08:00
|
|
|
tournament = models.ForeignKey(Tournament, models.CASCADE)
|
|
|
|
organiser = models.ForeignKey(Organiser, models.CASCADE)
|
2012-05-24 19:25:01 +08:00
|
|
|
|
2013-11-03 12:36:09 +08:00
|
|
|
|
2012-05-24 19:25:01 +08:00
|
|
|
class PoolStyle(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
2015-07-22 22:43:21 +08:00
|
|
|
pool = models.OneToOneField(Pool, models.CASCADE)
|