2008-08-09 17:19:23 +00:00
|
|
|
"""
|
|
|
|
Tests for forcing insert and update queries (instead of Django's normal
|
2011-12-17 17:37:24 +00:00
|
|
|
automatic behavior).
|
2008-08-09 17:19:23 +00:00
|
|
|
"""
|
2024-01-26 12:45:07 +01:00
|
|
|
|
2011-07-13 09:35:51 +00:00
|
|
|
from django.db import models
|
2008-08-09 17:19:23 +00:00
|
|
|
|
2011-10-13 18:04:12 +00:00
|
|
|
|
2008-08-09 17:19:23 +00:00
|
|
|
class Counter(models.Model):
|
2013-11-03 10:17:58 -08:00
|
|
|
name = models.CharField(max_length=10)
|
2008-08-09 17:19:23 +00:00
|
|
|
value = models.IntegerField()
|
|
|
|
|
2013-11-02 23:36:09 -05:00
|
|
|
|
2011-11-12 19:06:39 +00:00
|
|
|
class InheritedCounter(Counter):
|
|
|
|
tag = models.CharField(max_length=10)
|
|
|
|
|
2013-11-02 23:36:09 -05:00
|
|
|
|
2011-11-12 19:06:39 +00:00
|
|
|
class ProxyCounter(Counter):
|
|
|
|
class Meta:
|
|
|
|
proxy = True
|
|
|
|
|
2013-11-02 23:36:09 -05:00
|
|
|
|
2011-11-12 19:06:39 +00:00
|
|
|
class SubCounter(Counter):
|
|
|
|
pass
|
|
|
|
|
2013-11-02 23:36:09 -05:00
|
|
|
|
2023-06-29 11:47:42 +02:00
|
|
|
class SubSubCounter(SubCounter):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2008-08-09 17:19:23 +00:00
|
|
|
class WithCustomPK(models.Model):
|
|
|
|
name = models.IntegerField(primary_key=True)
|
|
|
|
value = models.IntegerField()
|
2023-06-22 18:23:11 +05:30
|
|
|
|
|
|
|
|
|
|
|
class OtherSubCounter(Counter):
|
|
|
|
other_counter_ptr = models.OneToOneField(
|
|
|
|
Counter, primary_key=True, parent_link=True, on_delete=models.CASCADE
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class DiamondSubSubCounter(SubCounter, OtherSubCounter):
|
|
|
|
pass
|