Django app architecture for pretixpresale

This commit is contained in:
Raphael Michel
2015-02-10 22:39:35 +01:00
parent ff3840a42b
commit b0e1546469
7 changed files with 29 additions and 3 deletions

View File

@@ -28,6 +28,8 @@ Python code
* For templates and models, follow the `Django Coding Style`_. * For templates and models, follow the `Django Coding Style`_.
* Use Django's class-based views
* Always mark all strings ever displayed to any user for translation. * Always mark all strings ever displayed to any user for translation.
LESS stylesheets LESS stylesheets

View File

@@ -59,6 +59,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'pretixcontrol.middleware.PermissionMiddleware', 'pretixcontrol.middleware.PermissionMiddleware',
'pretixpresale.middleware.EventMiddleware',
) )
TEMPLATE_CONTEXT_PROCESSORS = ( TEMPLATE_CONTEXT_PROCESSORS = (

View File

@@ -3,11 +3,13 @@ from django.contrib import admin
from django.conf import settings from django.conf import settings
import pretixcontrol.urls import pretixcontrol.urls
import pretixpresale.urls
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^control/', include(pretixcontrol.urls, namespace='control')), url(r'^control/', include(pretixcontrol.urls, namespace='control')),
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url(r'', include(pretixpresale.urls, namespace='presale')),
) )
if settings.DEBUG: if settings.DEBUG:

14
src/pretixpresale/urls.py Normal file
View File

@@ -0,0 +1,14 @@
from django.conf.urls import patterns, url, include
import pretixpresale.views.event
urlpatterns = patterns('',)
urlpatterns += patterns(
'pretixpresale.views.event',
url(r'^(?P<organizer>[^/]+)/(?P<event>[^/]+)/', include(
patterns(
'pretixpresale.views',
url(r'^$', pretixpresale.views.event.EventIndex.as_view(), name='event.index'),
)
))
)

View File

@@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.

View File

View File

@@ -0,0 +1,10 @@
from django.views.generic import TemplateView
class EventIndex(TemplateView):
template_name = "pretixpresale/event/index.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['event'] = self.request.event
return context