Re: JSONField() ordering and removing latest

2020-02-04 Thread Andrew C.
Usually, something that has multiple versions could be in an autoincrement field as the primary key. Then, in a JSONB field with GIN index (since you’re using PostgreSQL), you would have a dict of each version, like this: { “1”: { # beginning of article 1 “versions”: { “1”: { “title”: “Blah1”,

Re: JSONField() ordering and removing latest

2020-02-04 Thread Jody Fitzpatrick
I would change the model a bit, instead of having the timestamp as the key, i would set it in the dict. I believe that would be cleaner and would allow you to do a bit more of what you are going for. On Thursday, January 30, 2020 at 10:38:33 AM UTC-5, wagner wrote: > > Hello together, > i have

JSONField() ordering and removing latest

2020-01-30 Thread wagner
Hello together, i have the following problem. I need to save different versions of an article in a json object: { "1580388458.2877874": { "title": "Erster Artikel", "text_block_with_image": [{"text": "Super Text der einen weiterhilft", "image": "http://test.de/test.jpg"}] },