right now I have a view to show info about some tickets and I'm trying to add a functionality to filter those tickets.
Say I will have 4 filters:
Category Status
I want to give the option to use some of those filters, all or none, the thing is I'm kinda lost in how can I make it work in the urls. So far I found that you can add some optional arguments but they appear in some sort of succession like:
/May/Jack/Gas/Accepted
But if I only select 2 filters like /Jack/Accepted/ it grabs the filters incorrectly.
Is there a way I can achieve this? Or some other method I can use instead of this. Ty
Don't try and do this with URL arguments. Instead, use querystring arguments. The URL should be in the form:
my_path/?date=May&owner=Jack&category=Gas&status=accepted
and the URL pattern is just:
url(r'^my_path/$', views.my_view, 'my_url'),
and in the view you can access request.GET['date'] etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With