Aggregate (nested) JSON key value of JSONField Django PostgreSQL
I have a simple model setup as below, import random import string from django.db import models def random_default(): random_str = "".join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) return {"random": random_str, "total_price": random.randint(1, 100)} class Foo(models.Model): cart = models.JSONField(default=random_default) I want…