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 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"}]
> }, 
>
> "1580388556.6462297": {
> "title": "Erster Artikel angepasst", 
> "text_block_with_image": [{"text": "Super neuer neuer Text der einen 
> weiterhilft", "image": "http://test.de/test.jpg"}]
> }
>
> }
>
> I save this information in a JSONField().
>
> The numbers here are the current time in seconds. 
> I want to do an article template where i show the latest version of the 
> article (by current time seconds).
>
> How can i filter after the latest version?
>
> Articles.objects.filter( ?? )
>
>
>
> My second problem:
>
> How can i delete the oldest version (key), when i add a new entry?
>
>
> Thank you!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c7efc36e-76e5-40d2-a26e-31df40367d2c%40googlegroups.com.

Reply via email to