Created
January 2, 2015 11:26
-
-
Save sonthonaxrk/e2d77ce62a7d05e962f5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#urls.py | |
urlpatterns = patterns('', | |
url(r'^profile/$', login_required(views.BaseView.as_view( | |
template_name='profile_view.html' testVariable='testing' )), name='profile'), | |
) | |
#views.py | |
class BaseView(TemplateView): | |
testVariable = None | |
def dispatch(self, request, *args, **kwargs): | |
print(self.testVariable) | |
return super(BaseView, self).dispatch(request, *args, **kwargs) | |
def get_context_data(self, **kwargs): | |
return {'request' : self.request, | |
'user' : self.request.user } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment