Double is what Django uses to indicate a relationship rather than just an
underscore that is part of a field_name. You can make a custom field name
that is what the client uses as in my example but the actual ORM reference
has to use double.

On Thu, Jan 3, 2019 at 7:42 PM Asad Habib <[email protected]> wrote:

> Alan, thanks. I've gotten it to work now. Is there a way to replace the __
> (double underscore) with a single underscore when applying a filter to a
> field? For example, instead of
>
> score__range=x,y
>
> I would like to use
>
> score_range=x,y
>
> so the Django REST URL is more user friendly. Thanks.
>
>
> On Thu, Jan 3, 2019 at 6:43 PM Alan Crosswell <[email protected]> wrote:
>
>> Take a look at
>> https://github.com/columbia-it/django-jsonapi-training/blob/master/myapp/views.py#L142-L161
>>
>> On Thu, Jan 3, 2019 at 5:57 PM Foobar <[email protected]> wrote:
>>
>>> Has anyone successfully used DRF to make API calls using gte, lte, and
>>> range? If so, what extension did you use? I've tried django-filters and
>>> django-rest-framework-filters but neither work as stated. If someone can
>>> share their code that would be much appreciated. Thanks.
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django REST framework" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Alan Crosswell
>> Associate VP & CTO
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django REST framework" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django REST framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Alan Crosswell
Associate VP & CTO

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to