Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to apply list filter #59

Closed
iamshivam007 opened this issue Mar 3, 2017 · 1 comment
Closed

how to apply list filter #59

iamshivam007 opened this issue Mar 3, 2017 · 1 comment
Labels

Comments

@iamshivam007
Copy link

I have a list of choices in my database
MONTH_CHOICES = (
('1', _('January')),
('2', _('February')),
('10', _('October')),
('11', _('November')),
('12', _('December')),
)
Two objects contains month_list = ['1', '12'] and ['2']
I want to filter objects contains february month. but when I apply filter conatains filter with value '2' it is returing objects contains value '2' or '12' becuase it is searching in string
how can I apply list filter in this.

@blag blag added the wontfix label Mar 6, 2017
@blag
Copy link
Collaborator

blag commented Mar 6, 2017

You might be able to add a comma to the query part of the URL to search for just 2, like this:

http://.../admin/things/1?month_list__contains=,2,

This is a limitation of how d-msf serializes data to the database, and there isn't a scalable way we can fix this with that. I recommend using an array field like django.contrib.postgres.fields.ArrayField if you can.

Sorry I can't help you more. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants