5 Django packages that extend the functionality of models or add new classes of models

Conditional aggregates for Django queries, just like the famous SumIf and CountIf in Excel.

Imagine you have a model Offer like this one:

class Offer(models.Model):
    sponsor = models.ForeignKey(User)
    price = models.DecimalField(max_digits=9, decimal_places=2)
    status = models.CharField(max_length=30)
    expire_at = models.DateField(null=True, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    OPEN = "OPEN"
    REVOKED = "REVOKED"
    PAID = "PAID"

 

Django-localflavor/

Django-localflavor - Python

676

Country-specific Django helpers, formerly of contrib fame

 

Django-model-utils/

Django-model-utils - Python

2.2k

Django model mixins and utilities.

 

Utilities for implementing a modified pre-order traversal tree in django.

 

Efficient tree implementations for Django

Features

  • Flexible: Includes 3 different tree implementations with the same API:
    1. Adjacency List
    2. Materialized Path
    3. Nested Sets
  • Fast: Optimized non-naive tree operations
  • Easy: Uses Django Model Inheritance with abstract classes to define your own models.
  • Clean: Testable and well tested code base. Code/branch test coverage is above 96%. Test suite running on different versions of Python and Django: https://travis-ci.org/django-treebeard/django-treebeard/
django python tree-structure