OVERVIEW
A url with query parameters looks like.
http://example.api.com/search/?name=jhon&age=26
and on view if i am using django-filter all parameters are automatically extracted from request and it will return a filtered query-set .
views.py
class SearchView(TemplateView):
template_name = "search.html"
def get_queryset(self):
return SearchFilter(request.GET, queryset=Model.objects.all()).qs
def get_context_data(self, **kwargs):
context = super(SearchView, self).get_context_data(**kwargs)
return context
If i want to extract it manually from request.GET i can do.
def get_queryset(self):
# extracting query parameter
q = self.request.GET.get('name')
PROBLEM STATEMENT
My search url looks like
http://example.api.com/search/jhon-26
I am doing this because i don't want to reveal keys like 'name' and 'age' to public, this is for security abstraction these are the column of my db table .
I am getting jhon-26
in **kwargs, I want to split it and set as query parameter to request.GET so that my filter class will work fine
QUESTION
Is there anything to set attribute to request.GET?
# may be any set function available for this
self.request.GET.set('name', 'jhon')
How can i achieve this.