On Monday 27 March 2017 15:03:17 Martin Peveri wrote:
> Perfect!! This code works:
> 
> data = objectitem.data
> 
> data[0]['processed'] = True
> 
> objectitem.data = data
> 
> objectitem.save()
> 
> A last query that is not related to the insertion, but to the query.
> 
> If I want to get only records processed in True as I have to do?
> 
> This does not work, I get all the records:
> 
> objectitem.filter(data__contains=[{'processed': True}])

Looking at your data model, you should probably make data an ArrayField of 
JSONFields...
This would simplify things quite a bit.

That said, I would try data__contains={'processed': True}, but if that doesn't 
work, 
your problem is that your outer structure is a list, not an object, making 
filtering a lot 
harder.

-- 
Melvyn Sopacua

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1759464.AWYilJxbCY%40devstation.
For more options, visit https://groups.google.com/d/optout.

Reply via email to