Turns a callable into model field, analogous to python’s @property decorator. The callable will be used to compute the value of the field every time the model gets saved. If the callable has dependency information attached to it the fields value will also be recomputed if the dependencies require it.
Arguments:
Attaches a dependency to a callable, indicating the return value depends on fields in an other model that is related to the model the callable belongs to either through a ForeignKey in either direction or a ManyToManyField.
Arguments:
A BigIntegerField that gets set to a random value anytime the model is saved or a dependency is triggered.
All arguments are passed on to the contructor of BigIntegerField.
Add dependency information to the CacheKeyField. Accepts the same arguments like the denorm.depend_on_related decorator
A PositiveIntegerField that stores the number of rows related to this model instance through the specified manager. The value will be incrementally updated when related objects are added and removed.
Arguments:
Any additional arguments are passed on to the contructor of PositiveIntegerField.
Updates all model instances marked as dirty by the DirtyInstance model. After this method finishes the DirtyInstance table is empty and all denormalized fields have consistent data.
Calls denorm.flush during the response stage of every request. If your data mostly or only changes during requests this should be a good idea. If you run into performance problems with this (because flush() takes to long to complete) you can try using a daemon or handle flushing manually instead.
As usual the order of middleware classes matters. It makes a lot of sense to put DenormMiddleware after TransactionMiddleware in your MIDDLEWARE_CLASSES setting.