Skip to content

Instantly share code, notes, and snippets.

@monokrome
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monokrome/3a8a3350c0cbeb16d5c9 to your computer and use it in GitHub Desktop.
Save monokrome/3a8a3350c0cbeb16d5c9 to your computer and use it in GitHub Desktop.
{% if not is_viewing_all %}<a href="your_url_here">View All</a>{% endif %}
class MyView(generic.DetailView): # Whatever View you're working with.
def is_viewing_all(self):
return 'view_all' in self.request.GET
def get_context_data(self, **kwargs):
ctx = super(MyView, self).get_context_data(**kwargs)
# This is the important line, the rest is assumed to just use
# whatever is already within your current get_context_data.
ctx['is_viewing_all'] = self.is_viewing_all()
return ctx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment