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
No comments:
Post a Comment