2012-05-24 11:25:01 +00:00
|
|
|
"""
|
|
|
|
Existing related object instance caching.
|
|
|
|
|
2016-10-27 07:53:39 +00:00
|
|
|
Queries are not redone when going back through known relations.
|
2012-05-24 11:25:01 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
from django.db import models
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2012-05-24 11:25:01 +00:00
|
|
|
class Tournament(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2013-01-02 20:42:52 +00:00
|
|
|
class Organiser(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2012-05-24 11:25:01 +00:00
|
|
|
class Pool(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
2015-07-22 14:43:21 +00:00
|
|
|
tournament = models.ForeignKey(Tournament, models.CASCADE)
|
|
|
|
organiser = models.ForeignKey(Organiser, models.CASCADE)
|
2012-05-24 11:25:01 +00:00
|
|
|
|
2013-11-03 04:36:09 +00:00
|
|
|
|
2012-05-24 11:25:01 +00:00
|
|
|
class PoolStyle(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
2015-07-22 14:43:21 +00:00
|
|
|
pool = models.OneToOneField(Pool, models.CASCADE)
|
2022-12-26 06:13:44 +00:00
|
|
|
another_pool = models.OneToOneField(
|
|
|
|
Pool, models.CASCADE, null=True, related_name="another_style"
|
|
|
|
)
|