forked from CGM_Public/pretix_original
Multi-line location field, new field for admission time
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.7 on 2017-05-10 10:27
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import i18nfield.fields
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pretixbase', '0059_checkin_nonce'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='event',
|
||||||
|
name='date_admission',
|
||||||
|
field=models.DateTimeField(blank=True, null=True, verbose_name='Admission time'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='event',
|
||||||
|
name='location',
|
||||||
|
field=i18nfield.fields.I18nTextField(blank=True, max_length=200, null=True, verbose_name='Location'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -13,7 +13,7 @@ from django.template.defaultfilters import date as _date
|
|||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
from django.utils.timezone import make_aware, now
|
from django.utils.timezone import make_aware, now
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from i18nfield.fields import I18nCharField
|
from i18nfield.fields import I18nCharField, I18nTextField
|
||||||
|
|
||||||
from pretix.base.email import CustomSMTPBackend
|
from pretix.base.email import CustomSMTPBackend
|
||||||
from pretix.base.models.base import LoggedModel
|
from pretix.base.models.base import LoggedModel
|
||||||
@@ -85,6 +85,8 @@ class Event(LoggedModel):
|
|||||||
date_from = models.DateTimeField(verbose_name=_("Event start time"))
|
date_from = models.DateTimeField(verbose_name=_("Event start time"))
|
||||||
date_to = models.DateTimeField(null=True, blank=True,
|
date_to = models.DateTimeField(null=True, blank=True,
|
||||||
verbose_name=_("Event end time"))
|
verbose_name=_("Event end time"))
|
||||||
|
date_admission = models.DateTimeField(null=True, blank=True,
|
||||||
|
verbose_name=_("Admission time"))
|
||||||
is_public = models.BooleanField(default=False,
|
is_public = models.BooleanField(default=False,
|
||||||
verbose_name=_("Visible in public lists"),
|
verbose_name=_("Visible in public lists"),
|
||||||
help_text=_("If selected, this event may show up on the ticket system's start page "
|
help_text=_("If selected, this event may show up on the ticket system's start page "
|
||||||
@@ -99,7 +101,7 @@ class Event(LoggedModel):
|
|||||||
verbose_name=_("Start of presale"),
|
verbose_name=_("Start of presale"),
|
||||||
help_text=_("No products will be sold before this date."),
|
help_text=_("No products will be sold before this date."),
|
||||||
)
|
)
|
||||||
location = I18nCharField(
|
location = I18nTextField(
|
||||||
null=True, blank=True,
|
null=True, blank=True,
|
||||||
max_length=200,
|
max_length=200,
|
||||||
verbose_name=_("Location"),
|
verbose_name=_("Location"),
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ class EventUpdateForm(I18nModelForm):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.fields['slug'].widget.attrs['readonly'] = 'readonly'
|
self.fields['slug'].widget.attrs['readonly'] = 'readonly'
|
||||||
|
self.fields['location'].widget.attrs['rows'] = '3'
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Event
|
model = Event
|
||||||
@@ -153,6 +154,7 @@ class EventUpdateForm(I18nModelForm):
|
|||||||
'currency',
|
'currency',
|
||||||
'date_from',
|
'date_from',
|
||||||
'date_to',
|
'date_to',
|
||||||
|
'date_admission',
|
||||||
'is_public',
|
'is_public',
|
||||||
'presale_start',
|
'presale_start',
|
||||||
'presale_end',
|
'presale_end',
|
||||||
@@ -161,6 +163,7 @@ class EventUpdateForm(I18nModelForm):
|
|||||||
widgets = {
|
widgets = {
|
||||||
'date_from': forms.DateTimeInput(attrs={'class': 'datetimepicker'}),
|
'date_from': forms.DateTimeInput(attrs={'class': 'datetimepicker'}),
|
||||||
'date_to': forms.DateTimeInput(attrs={'class': 'datetimepicker', 'data-date-after': '#id_date_from'}),
|
'date_to': forms.DateTimeInput(attrs={'class': 'datetimepicker', 'data-date-after': '#id_date_from'}),
|
||||||
|
'date_admission': forms.DateTimeInput(attrs={'class': 'datetimepicker'}),
|
||||||
'presale_start': forms.DateTimeInput(attrs={'class': 'datetimepicker'}),
|
'presale_start': forms.DateTimeInput(attrs={'class': 'datetimepicker'}),
|
||||||
'presale_end': forms.DateTimeInput(attrs={'class': 'datetimepicker',
|
'presale_end': forms.DateTimeInput(attrs={'class': 'datetimepicker',
|
||||||
'data-date-after': '#id_presale_start'}),
|
'data-date-after': '#id_presale_start'}),
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
{% bootstrap_field form.date_from layout="horizontal" %}
|
{% bootstrap_field form.date_from layout="horizontal" %}
|
||||||
{% bootstrap_field form.date_to layout="horizontal" %}
|
{% bootstrap_field form.date_to layout="horizontal" %}
|
||||||
{% bootstrap_field form.location layout="horizontal" %}
|
{% bootstrap_field form.location layout="horizontal" %}
|
||||||
|
{% bootstrap_field form.date_admission layout="horizontal" %}
|
||||||
{% bootstrap_field form.currency layout="horizontal" %}
|
{% bootstrap_field form.currency layout="horizontal" %}
|
||||||
{% bootstrap_field form.is_public layout="horizontal" %}
|
{% bootstrap_field form.is_public layout="horizontal" %}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
# Date according to https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
# Date according to https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
|
||||||
SHORT_DATE_FORMAT = 'Y-m-d'
|
SHORT_DATE_FORMAT = 'Y-m-d'
|
||||||
SHORT_DATETIME_FORMAT = 'Y-m-d H:i'
|
SHORT_DATETIME_FORMAT = 'Y-m-d H:i'
|
||||||
|
TIME_FORMAT = 'H:i'
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class PdfTicketOutput(BaseTicketOutput):
|
|||||||
elif o['content'] == 'event_name':
|
elif o['content'] == 'event_name':
|
||||||
return str(order.event)
|
return str(order.event)
|
||||||
elif o['content'] == 'event_location':
|
elif o['content'] == 'event_location':
|
||||||
return str(order.event.location)
|
return str(order.event.location).replace("\n", "<br/>\n")
|
||||||
elif o['content'] == 'event_date':
|
elif o['content'] == 'event_date':
|
||||||
return order.event.get_date_from_display(show_times=False)
|
return order.event.get_date_from_display(show_times=False)
|
||||||
elif o['content'] == 'event_begin_time':
|
elif o['content'] == 'event_begin_time':
|
||||||
|
|||||||
@@ -28,7 +28,8 @@
|
|||||||
<div class="col-md-4 col-xs-12">
|
<div class="col-md-4 col-xs-12">
|
||||||
<form method="post" data-asynctask action="{% eventurl request.event "presale:event.cart.clear" %}">
|
<form method="post" data-asynctask action="{% eventurl request.event "presale:event.cart.clear" %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<button class="btn btn-block btn-default btn-lg" type="submit"><i class="fa fa-close"></i> {% trans "Empty cart" %}</button>
|
<button class="btn btn-block btn-default btn-lg" type="submit">
|
||||||
|
<i class="fa fa-close"></i> {% trans "Empty cart" %}</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 col-md-offset-4 col-xs-12">
|
<div class="col-md-4 col-md-offset-4 col-xs-12">
|
||||||
@@ -66,15 +67,57 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<div>
|
<div>
|
||||||
{% if frontpage_text %}
|
{% if frontpage_text %}
|
||||||
<div>
|
<div>
|
||||||
{{ frontpage_text|rich_text }}
|
{{ frontpage_text|rich_text }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p class="text-right">
|
|
||||||
<a href="{% eventurl event "presale:event.ical.download" %}" class="btn btn-link btn-xs">
|
|
||||||
<i class="fa fa-calendar"></i> {% trans "Add to Calendar" %}
|
{% if event.location %}
|
||||||
</a>
|
<div class="info-row">
|
||||||
</p>
|
<span class="fa fa-map-marker fa-fw"></span>
|
||||||
|
<p>
|
||||||
|
{{ event.location|linebreaksbr }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if event.settings.show_times or event.date_admission %}
|
||||||
|
<div class="info-row">
|
||||||
|
<span class="fa fa-clock-o fa-fw"></span>
|
||||||
|
<p>
|
||||||
|
{% if event.settings.show_times %}
|
||||||
|
{% blocktrans trimmed with time=event.date_from|date:"TIME_FORMAT" %}
|
||||||
|
Begin: {{ time }}
|
||||||
|
{% endblocktrans %}
|
||||||
|
{% endif %}
|
||||||
|
{% if event.date_admission and event.settings.show_times %}
|
||||||
|
<br>
|
||||||
|
{% endif %}
|
||||||
|
{% if event.date_admission %}
|
||||||
|
{% if event.date_admission|date:"SHORT_DATE_FORMAT" == event.date_from|date:"SHORT_DATE_FORMAT" %}
|
||||||
|
{% blocktrans trimmed with time=event.date_admission|date:"TIME_FORMAT" %}
|
||||||
|
Admission: {{ time }}
|
||||||
|
{% endblocktrans %}
|
||||||
|
{% else %}
|
||||||
|
{% blocktrans trimmed with datetime=event.date_admission|date:"SHORT_DATETIME_FORMAT" %}
|
||||||
|
Admission: {{ datetime }}
|
||||||
|
{% endblocktrans %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
<br>
|
||||||
|
<a href="{% eventurl event "presale:event.ical.download" %}">
|
||||||
|
<i class="fa fa-calendar"></i> {% trans "Add to Calendar" %}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<p class="text-right">
|
||||||
|
<a href="{% eventurl event "presale:event.ical.download" %}" class="btn-xs">
|
||||||
|
<i class="fa fa-calendar"></i> {% trans "Add to Calendar" %}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% eventsignal event "pretix.presale.signals.front_page_top" %}
|
{% eventsignal event "pretix.presale.signals.front_page_top" %}
|
||||||
@@ -112,11 +155,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if item.min_per_order %}
|
{% if item.min_per_order %}
|
||||||
<p><small>
|
<p>
|
||||||
{% blocktrans trimmed with num=item.min_per_order %}
|
<small>
|
||||||
minimum amount to order: {{ num }}
|
{% blocktrans trimmed with num=item.min_per_order %}
|
||||||
{% endblocktrans %}
|
minimum amount to order: {{ num }}
|
||||||
</small></p>
|
{% endblocktrans %}
|
||||||
|
</small>
|
||||||
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-xs-6 price">
|
<div class="col-md-2 col-xs-6 price">
|
||||||
@@ -222,11 +267,13 @@
|
|||||||
{% include "pretixpresale/event/fragment_quota_left.html" with avail=item.cached_availability %}
|
{% include "pretixpresale/event/fragment_quota_left.html" with avail=item.cached_availability %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if item.min_per_order %}
|
{% if item.min_per_order %}
|
||||||
<p><small>
|
<p>
|
||||||
{% blocktrans trimmed with num=item.min_per_order %}
|
<small>
|
||||||
minimum amount to order: {{ num }}
|
{% blocktrans trimmed with num=item.min_per_order %}
|
||||||
{% endblocktrans %}
|
minimum amount to order: {{ num }}
|
||||||
</small></p>
|
{% endblocktrans %}
|
||||||
|
</small>
|
||||||
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-xs-6 price">
|
<div class="col-md-2 col-xs-6 price">
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from django.db.models import Count, Prefetch, Q
|
|||||||
from django.http import Http404, HttpResponse
|
from django.http import Http404, HttpResponse
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
from django.utils.formats import date_format
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
@@ -149,6 +150,11 @@ class EventIcalDownload(EventViewMixin, View):
|
|||||||
else:
|
else:
|
||||||
vevent.add('dtend').value = event.date_to.astimezone(self.event_timezone).date()
|
vevent.add('dtend').value = event.date_to.astimezone(self.event_timezone).date()
|
||||||
|
|
||||||
|
if event.date_admission:
|
||||||
|
vevent.add('description').value = str(_('Admission: {datetime}')).format(
|
||||||
|
datetime=date_format(event.date_admission.astimezone(self.event_timezone), 'SHORT_DATETIME_FORMAT')
|
||||||
|
)
|
||||||
|
|
||||||
resp = HttpResponse(cal.serialize(), content_type='text/calendar')
|
resp = HttpResponse(cal.serialize(), content_type='text/calendar')
|
||||||
resp['Content-Disposition'] = 'attachment; filename="{}-{}.ics"'.format(
|
resp['Content-Disposition'] = 'attachment; filename="{}-{}.ics"'.format(
|
||||||
event.organizer.slug, event.slug
|
event.organizer.slug, event.slug
|
||||||
|
|||||||
@@ -116,6 +116,22 @@ body.loading .container {
|
|||||||
-webkit-transition: opacity .5s ease-in-out;
|
-webkit-transition: opacity .5s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.info-row {
|
||||||
|
& > .fa {
|
||||||
|
font-size: 26px;
|
||||||
|
color: $brand-primary;
|
||||||
|
float: left;
|
||||||
|
margin-top: 3px;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
min-height: 30px;
|
||||||
|
margin-left: 40px;
|
||||||
|
}
|
||||||
|
p:first-child {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (min-width: $screen-md-min) {
|
@media (min-width: $screen-md-min) {
|
||||||
.thank-you {
|
.thank-you {
|
||||||
min-height: 170px;
|
min-height: 170px;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
from django.utils import translation
|
from django.utils import translation
|
||||||
|
|
||||||
from pretix.helpers.daterange import daterange
|
from pretix.helpers.daterange import daterange
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user