I need to access the value of a variable in urls.py, the variable is on a view.
This is the view:
class MyFacetedSearchView(SearchView):
__name__ = 'MyFacetedSearchView'
def extra_context(self):
q_query_string = self.request.META
extra = super(MyFacetedSearchView, self).extra_context()
extra['request'] = self.request
extra['facets'] = self.results.facet_counts()
extra['number_results'] = self.results.count() # Adicionado p AL
extra['q_query_string'] = q_query_string # Adicionado p AL
return extra
I need to access the value of this variable(q_query_string) in urls.py. This variable is passed on the url, just like this:
http://127.0.0.1/results/?q=this_is_the_value_that_i_need_to_access_in_urls_py
Can someone give me a clue?
Best Regards,
If you need to access some variable from view without GET dict you can use import:
Be careful! In you example variable get their value only after running method.