forked from CGM_Public/pretix_original
Static file and template setup for pretixpresale
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import resolve
|
||||
from django.utils.encoding import force_str
|
||||
from django.utils.six.moves.urllib.parse import urlparse
|
||||
from django.shortcuts import resolve_url
|
||||
from django.contrib.auth import REDIRECT_FIELD_NAME
|
||||
from django.http import HttpResponseNotFound
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from pretixbase.models import Event
|
||||
|
||||
|
||||
class EventMiddleware:
|
||||
|
||||
def process_request(self, request):
|
||||
url = resolve(request.path_info)
|
||||
url_namespace = url.namespace
|
||||
url_name = url.url_name
|
||||
if url_namespace != 'presale':
|
||||
return
|
||||
if 'event.' in url_name and 'event' in url.kwargs:
|
||||
request.event = Event.objects.current.get(
|
||||
slug=url.kwargs['event'],
|
||||
organizer__slug=url.kwargs['organizer'],
|
||||
)
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
$(function () {
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
@import "../../../../pretixbase/static/bootstrap/less/bootstrap.less";
|
||||
@import "../../../../pretixbase/static/fontawesome/less/font-awesome.less";
|
||||
@fa-font-path: "../../fontawesome/fonts";
|
||||
@@ -0,0 +1,24 @@
|
||||
{% load compress %}
|
||||
{% load staticfiles %}
|
||||
{% load i18n %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{% block title %}{% endblock %}{% if url_name != "event.index" %} :: {% endif %}{{ event.name }}</title>
|
||||
{% compress css %}
|
||||
<link rel="stylesheet" type="text/less" href="{% static "pretixpresale/less/main.less" %}" />
|
||||
{% endcompress %}
|
||||
{% compress js %}
|
||||
<script type="text/javascript" src="{% static "jquery/js/jquery-2.1.1.min.js" %}"></script>
|
||||
<script type="text/javascript" src="{% static "js/jquery.formset.js" %}"></script>
|
||||
<script type="text/javascript" src="{% static "bootstrap/dist/js/bootstrap.js" %}"></script>
|
||||
{% endcompress %}
|
||||
</head>
|
||||
<body>
|
||||
<div class="container event">
|
||||
<h1>{{ event.name }}</h1>
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,5 @@
|
||||
{% extends "pretixpresale/event/base.html" %}
|
||||
|
||||
{% block content %}
|
||||
Hallo
|
||||
{% endblock %}
|
||||
@@ -1,10 +1,16 @@
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
|
||||
class EventIndex(TemplateView):
|
||||
template_name = "pretixpresale/event/index.html"
|
||||
|
||||
class EventViewMixin:
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['event'] = self.request.event
|
||||
return context
|
||||
|
||||
|
||||
class EventIndex(EventViewMixin, TemplateView):
|
||||
template_name = "pretixpresale/event/index.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
return context
|
||||
|
||||
Reference in New Issue
Block a user