Opened 2 years ago

Closed 22 months ago

#32179 closed New feature (fixed)

Add JSONObject Func

Reported by: Chiorufarewerin Owned by: Chiorufarewerin
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords: json_object, jsonb_build_object, JSONObject
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


So I currently use for build json object for postgres like:

    Value('name'), 'authors__name',
    Value('alias'), 'authors__alias',

I checked other dbs formats for this, and all of this have that functional:

I use it for related objects, for example:

class Article(models.Model):
    title = models.CharField(max_length=50)

class Product(models.Model):
    article = models.ForeignKey(Article, related_name='products', on_delete=models.CASCADE)
    name = models.CharField(max_length=255)

        Value('title'), 'article__title',
).values('name', 'article_json').first()

So, with JSONObject will be something like this:

).values('name', 'article_json').first()

Change History (6)

comment:1 Changed 2 years ago by Chiorufarewerin

Owner: changed from nobody to Chiorufarewerin
Status: newassigned

comment:2 Changed 2 years ago by Simon Charette

Triage Stage: UnreviewedAccepted

comment:3 Changed 2 years ago by Simon Charette

Has patch: set

comment:4 Changed 2 years ago by Mariusz Felisiak

Patch needs improvement: set

comment:5 Changed 22 months ago by Mariusz Felisiak

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:6 Changed 22 months ago by Mariusz Felisiak <felisiak.mariusz@…>

Resolution: fixed
Status: assignedclosed

In 48b4bae9:

Fixed #32179 -- Added JSONObject database function.

Note: See TracTickets for help on using tickets.
Back to Top