-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from groovecoder/request-context-processor
use request context processor instead of custom view classes
- Loading branch information
Showing
3 changed files
with
14 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
'''Views for bpz''' | ||
from django.conf.urls import patterns, url | ||
|
||
from .views import RequestView | ||
from django.views.generic import TemplateView | ||
|
||
urlpatterns = patterns( | ||
'', | ||
url(r'^$', RequestView.as_view( | ||
url(r'^$', TemplateView.as_view( | ||
template_name='bpz/home.jinja2'), | ||
name='home'), | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1 @@ | ||
from django.views.generic import TemplateView | ||
|
||
|
||
class RequestContextMixin(object): | ||
def get_context_data(self, **kwargs): | ||
ctx = super(RequestContextMixin, self).get_context_data(**kwargs) | ||
ctx['request'] = self.request | ||
return ctx | ||
|
||
|
||
class RequestView(RequestContextMixin, TemplateView): | ||
pass | ||
# bpz views here |
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