It have been from a week that I search without any answer to my problem. I don't know if I proceed in the good way, but I try to have an url that look like this : article/title/0/search=ad/2017-08-01/2017-08-09/; where the parameter are (in brace) : article/{filter}/{page}/search={search}/{date1}/{date2}/.
My url.py regex is:
url(r'article/(?P<filter>.+)/(?P<page>\d+)/(?:search=(?P<search>.*)/)?(?:(?P<date1>(\d{4}-\d{1,2}-\d{1,2})?)/)(?:(?P<date2>(\d{4}-\d{1,2}-\d{1,2})?)/)?$')
When the value search, date1 and date2 are fill, my url think that the {searched word}/2017-08-01/2017-08-09/ is the search value.
When search, date1 and date2 are empty, my link are like this: article/title/0/search=///. When the dates are filled article/title/0/search=/2017-08-01/2017-08-09/.
In my template, I need my url to be like this :{% url "view" filter page search date1 date2 %}
Can someone help me and correct me if i did it in the wrong way?
EDIT
I'll try to re-ask my problem in another ways:
In my template, in have a form which have 3 fields search, date1 and date2 not required, so they can be None (this is my problem). I have some links that need to change only one of the view parameters filter, page and keep the field param in the url.
When the form is POST to my view (which is actually like this def AllArticle(request, filter, page, search="", date1="", date2="")), I use them to filter my ArticleModel object (I don't need help for this, already done and work).
According to @Cory_Madden, I never use this method before and I don't know how to use it. I just tried it and django return me a MultiValueDictKeyError.