Skip to content

Instantly share code, notes, and snippets.

@anddam
Created February 12, 2017 20:49
Show Gist options
  • Save anddam/8903b390b9ef3986e72823ef375ac17f to your computer and use it in GitHub Desktop.
Save anddam/8903b390b9ef3986e72823ef375ac17f to your computer and use it in GitHub Desktop.
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
filter_argument = self.request.GET.get('filter')
if filter_argument:
cleaned_argument = filter_argument.strip()
if cleaned_argument:
context['filter'] = cleaned_argument
context['orderby'] = self.request.GET.get('orderby')
return context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment