2012-05-24 13:25:01 +02: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 05:36:09 +01:00
|
|
|
|
2012-05-24 13:25:01 +02:00
|
|
|
class Tournament(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
|
|
|
|
2013-11-03 05:36:09 +01:00
|
|
|
|
2013-01-02 21:42:52 +01:00
|
|
|
class Organiser(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
|
|
|
|
2013-11-03 05:36:09 +01:00
|
|
|
|
2012-05-24 13:25:01 +02:00
|
|
|
class Pool(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
|
|
|
tournament = models.ForeignKey(Tournament)
|
2013-01-02 21:42:52 +01:00
|
|
|
organiser = models.ForeignKey(Organiser)
|
2012-05-24 13:25:01 +02:00
|
|
|
|
2013-11-03 05:36:09 +01:00
|
|
|
|
2012-05-24 13:25:01 +02:00
|
|
|
class PoolStyle(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
|
|
|
pool = models.OneToOneField(Pool)
|