Last active
August 29, 2015 14:06
-
-
Save monokrome/3a8a3350c0cbeb16d5c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if not is_viewing_all %}<a href="your_url_here">View All</a>{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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