Materialized Annotations for Django Models
Project description
Materialized Annotations for Django Models. Typical use-case is to keep track of the number of comments in a post, or the number of contributions a user has made.
Installation
pip install dj_mano
Usage
@materialized_annotations
class ModelA(models.Model):
count_b = MaterializedAnnotationIntegerField(models.Count('models_b'))
count_c = MaterializedAnnotationIntegerField(models.Count('models_b__models_c'))
class ModelB(models.Model):
model_a = models.ForeignKey('ModelA', related_name='models_b')
class ModelC(models.Model):
model_b = models.ForeignKey('ModelB', related_name='models_c')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dj_mano-0.1.1.tar.gz
(3.9 kB
view hashes)