Last active
December 23, 2015 16:29
-
-
Save mikelopez/6662865 to your computer and use it in GitHub Desktop.
Sample code for blogger entry
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
from django.views.generic import DetailView, ListView, \ | |
TemplateView, CreateView, \ | |
View | |
from django.utils.decorators import method_decorator | |
class IndexPage(TemplateView): | |
""" | |
Main Index Page. | |
""" | |
template_name = 'frontend/index.html' | |
@method_decorator(login_required) | |
def dispatch(self, *args, **kwargs): | |
# do stuff with self.request | |
return super(IndexPage, self).dispatch(*args, **kwargs) | |
def get_context_data(self, **kwargs): | |
data = "Some cool data!" | |
return {'data': data} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment