Debian Codegraph @

tests/force_insert_update/models.py

raw
1 """
2 Tests for forcing insert and update queries (instead of Django's normal
3 automatic behavior).
4 """
5
6 from django.db import models
7
8
9 class Counter(models.Model):
10 name = models.CharField(max_length=10)
11 value = models.IntegerField()
12
13
14 class InheritedCounter(Counter):
15 tag = models.CharField(max_length=10)
16
17
18 class ProxyCounter(Counter):
19 class Meta:
20 proxy = True
21
22
23 class SubCounter(Counter):
24 pass
25
26
27 class SubSubCounter(SubCounter):
28 pass
29
30
31 class WithCustomPK(models.Model):
32 name = models.IntegerField(primary_key=True)
33 value = models.IntegerField()
34
35
36 class OtherSubCounter(Counter):
37 other_counter_ptr = models.OneToOneField(
38 Counter, primary_key=True, parent_link=True, on_delete=models.CASCADE
39 )
40
41
42 class DiamondSubSubCounter(SubCounter, OtherSubCounter):
43 pass