MCPcopy
hub / github.com/django/django / GeneratedFieldStoredProduct

Class GeneratedFieldStoredProduct

tests/constraints/models.py:32–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31
32class GeneratedFieldStoredProduct(models.Model):
33 name = models.CharField(max_length=255, null=True)
34 price = models.IntegerField(null=True)
35 discounted_price = models.IntegerField(null=True)
36 rebate = models.GeneratedField(
37 expression=Coalesce("price", 0)
38 - Coalesce("discounted_price", Coalesce("price", 0)),
39 output_field=models.IntegerField(),
40 db_persist=True,
41 )
42 lower_name = models.GeneratedField(
43 expression=Lower(models.F("name")),
44 output_field=models.CharField(max_length=255, null=True),
45 db_persist=True,
46 )
47
48 class Meta:
49 required_db_features = {"supports_stored_generated_columns"}
50
51
52class GeneratedFieldVirtualProduct(models.Model):

Callers

nothing calls this directly

Calls 3

CoalesceClass · 0.90
LowerClass · 0.90
FMethod · 0.80

Tested by

no test coverage detected