#28012: JsonField PostgreSQL problem
--------------------------------------------+------------------------
               Reporter:  Martín Peveri     |          Owner:  (none)
                   Type:  Uncategorized     |         Status:  new
              Component:  contrib.postgres  |        Version:  1.10
               Severity:  Normal            |       Keywords:
           Triage Stage:  Unreviewed        |      Has patch:  0
    Needs documentation:  0                 |    Needs tests:  0
Patch needs improvement:  0                 |  Easy pickings:  0
                  UI/UX:  0                 |
--------------------------------------------+------------------------
 Hi, I have a model with a field JsonField of PostgreSQL of name 'data',
 like this:

 {{{
 class ItemCampaign(models.Model):

    campaign = models.ForeignKey(
        Campaign, related_name="itemscampaign", verbose_name="Item campaña"
    )
    data = JSONField(default=dict)

    def __str__(self):
        return self.campaign.name
 }}}


 In this field i have one record with this data, for example:

 {{{
 [{'number': '1160188479', 'id': 0, 'content': 'hello', 'processed': True},
 {'number': '1160188479', 'id': 1, 'content': 'hello', 'processed': False},
 {'number': '1160188479', 'id': 2, 'content': 'hello', 'processed': False},
 {'number': '1162341721', 'id': 3, 'content': 'hello', 'processed': False},
 {'number': '1162341721', 'id': 4, 'content': 'hello', 'processed': False},
 {'number': '1162341721', 'id': 5, 'content': 'hello', 'processed': False}]
 }}}

 If i want filtered, like this:

 {{{
 itemscampaign.filter(data__contains=[{'processed': True}])
 }}}

 This code returned all content data field, Instead of just the dict with
 'processed' in True. I want know if this is an error or not is possible.

 Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/28012>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.2d5012ad9f736aa288b71c43cd07fbba%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to