R
R
Radist_1012016-01-20 14:52:07
Django
Radist_101, 2016-01-20 14:52:07

How to filter with different parameters for one json field?

Hello!
There are two models:

class Auto(models.Model):
    pass

class PropertyValue(models.Model):
    data = JSONField(default={'value': None})
    auto = models.ForeignKey(Auto, related_name='property_values')

The get request receives parameters for filtering, for example site.com?prop_1=10&prop_2=5&prop_3=100.
The prop_X parameters are required to filter by the PropertyValue().data['value']
field

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question