forked from CGM_Public/pretix_original
Django app architecture for pretixpresale
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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 = (
|
||||||
|
|||||||
@@ -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
14
src/pretixpresale/urls.py
Normal 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'),
|
||||||
|
)
|
||||||
|
))
|
||||||
|
)
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
from django.shortcuts import render
|
|
||||||
|
|
||||||
# Create your views here.
|
|
||||||
0
src/pretixpresale/views/__init__.py
Normal file
0
src/pretixpresale/views/__init__.py
Normal file
10
src/pretixpresale/views/event.py
Normal file
10
src/pretixpresale/views/event.py
Normal 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
|
||||||
Reference in New Issue
Block a user