Add sub-events and relative date settings (#503)

* Data model

* little crud

* SubEventItemForm etc

* Drop SubEventItem.active, quota editor

* Fix failing tests

* First frontend stuff

* Addons form stuff

* Quota calculation

* net price display on EventIndex

* Add tests, solve some bugs

* Correct quota selection in more places, consolidate pricing logic

* Fix failing quota tests

* Fix TypeError

* Add tests for checkout

* Fixed a bug in QuotaForm

* Prevent immutable cart if a quota was removed from an item

* Add tests for pricing

* Handle waiting list

* Filter in check-in list

* Fixed import lost in rebase

* Fix waiting list widget

* Voucher management

* Voucher redemption

* Fix broken tests

* Add subevents to OrderChangeManager

* Create a subevent during event creation

* Fix bulk voucher creation

* Introduce subevent.active

* Copy from for subevents

* Show active in list

* ICal download for subevents

* Check start and end of presale

* Failing tests / show cart logic

* Test

* Rebase migrations

* REST API integration of sub-events

* Integrate quota calculation into the traditional quota form

* Make subevent argument to add_position optional

* Log-display foo

* pretixdroid and subevents

* Filter by subevent

* Add more tests

* Some mor tests

* Rebase fixes

* More tests

* Relative dates

* Restrict selection in relative datetime widgets

* Filter subevent list

* Re-label has_subevents

* Rebase fixes, subevents in calendar view

* Performance and caching issues

* Refactor calendar templates

* Permission tests

* Calendar fixes and month selection

* subevent selection

* Rename subevents to dates

* Add tests for calendar views
This commit is contained in:
Raphael Michel
2017-07-11 13:56:00 +02:00
committed by GitHub
parent 554800c06f
commit 8123effa65
141 changed files with 5920 additions and 1012 deletions

View File

@@ -4,7 +4,9 @@ from collections import OrderedDict
from django import forms
from django.db.models.functions import Coalesce
from django.utils.translation import ugettext as _, ugettext_lazy
from django.utils.translation import (
pgettext, pgettext_lazy, ugettext as _, ugettext_lazy,
)
from pretix.base.exporter import BaseExporter
from pretix.base.models import Order, OrderPosition, Question
@@ -21,7 +23,7 @@ class CSVCheckinList(BaseCheckinList):
@property
def export_form_fields(self):
return OrderedDict(
d = OrderedDict(
[
('items',
forms.ModelMultipleChoiceField(
@@ -61,6 +63,14 @@ class CSVCheckinList(BaseCheckinList):
)),
]
)
if self.event.has_subevents:
d['subevent'] = forms.ModelChoiceField(
self.event.subevents.all(),
label=pgettext_lazy('subevent', 'Date'),
required=False,
empty_label=pgettext_lazy('subevent', 'All dates')
)
return d
def render(self, form_data: dict):
output = io.StringIO()
@@ -81,6 +91,8 @@ class CSVCheckinList(BaseCheckinList):
headers = [
_('Order code'), _('Attendee name'), _('Product'), _('Price')
]
if form_data.get('subevent'):
qs = qs.filter(subevent=form_data.get('subevent'))
if form_data['paid_only']:
qs = qs.filter(order__status=Order.STATUS_PAID)
else:
@@ -93,6 +105,9 @@ class CSVCheckinList(BaseCheckinList):
if self.event.settings.attendee_emails_asked:
headers.append(_('E-mail'))
if self.event.has_subevents:
headers.append(pgettext('subevent', 'Date'))
for q in questions:
headers.append(str(q.question))
@@ -111,6 +126,8 @@ class CSVCheckinList(BaseCheckinList):
row.append(op.secret)
if self.event.settings.attendee_emails_asked:
row.append(op.attendee_email or (op.addon_to.attendee_email if op.addon_to else ''))
if self.event.has_subevents:
row.append(str(op.subevent))
acache = {}
for a in op.answers.all():
acache[a.question_id] = str(a)