Skip to content

Commit

Permalink
OPEN-3126: Better handling of root URL views v3
Browse files Browse the repository at this point in the history
  • Loading branch information
thriuin committed Feb 9, 2024
1 parent 5655676 commit 75822e2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,19 +1041,22 @@ def get(self, request: HttpRequest):
if settings.SEARCH_LANG_USE_PATH:
if request.LANGUAGE_CODE == 'fr':
if settings.DEFAULT_SEARCH_TYPE:
return redirect(f'/rechecher/fr/{settings.DEFAULT_SEARCH_TYPE}')
return HttpResponseRedirect(f'/rechecher/fr/{settings.DEFAULT_SEARCH_TYPE}')
else:
return redirect('/rechecher/fr/')
return HttpResponseRedirect('/rechecher/fr/')
else:
if settings.DEFAULT_SEARCH_TYPE:
return redirect(f'/search/{request.LANGUAGE_CODE}/{settings.DEFAULT_SEARCH_TYPE}/')
return HttpResponseRedirect(f'/search/{request.LANGUAGE_CODE}/{settings.DEFAULT_SEARCH_TYPE}/')
else:
return redirect('/search/{0}/'.format(request.LANGUAGE_CODE) )
return HttpResponseRedirect('/search/{0}/'.format(request.LANGUAGE_CODE) )
else:
if settings.DEFAULT_SEARCH_TYPE:
return redirect(f'/{settings.SEARCH_HOST_PATH}/{settings.DEFAULT_SEARCH_TYPE}/')
if settings.SEARCH_HOST_PATH:
return HttpResponseRedirect(f'/{settings.SEARCH_HOST_PATH}/{settings.DEFAULT_SEARCH_TYPE}/')
else:
return HttpResponseRedirect(f'/{settings.DEFAULT_SEARCH_TYPE}/')
else:
if settings.SEARCH_HOST_PATH:
return redirect(f'/{settings.SEARCH_HOST_PATH}/')
return HttpResponseRedirect(f'/{settings.SEARCH_HOST_PATH}/')
else:
return redirect('/')
return HttpResponseRedirect('/')

0 comments on commit 75822e2

Please sign in to comment.