mirror of
https://github.com/pretix/pretix.git
synced 2026-08-22 12:42:00 +00:00
Allow RelativeDate in relation to a moment of order (#6160)
* initial implementation * factor out _resolve_base_date * add js to prevent illegal inputs * fix tests * Update src/pretix/base/reldate.py Co-authored-by: Raphael Michel <michel@pretix.eu> * Apply suggestions from code review Co-authored-by: Raphael Michel <mail@raphaelmichel.de> * move js includes of to fragment_js.html * add type annotations * moves logic from RelativeDateWrapper into RelativeDate and adds BaseChoice for configuring which models attributes support which relationship * fix tests * test upgrade behaviour * Apply suggestions from code review Co-authored-by: Raphael Michel <mail@raphaelmichel.de> * move reldate.js include in correct file * add OptionAttrsSelect to allow select options with their own attributes per value * add a little bit of information to the tests for future reference * rewrite reldate.js use data-attributes * general cleanup * add test for order.subevents cases * use correct choice format * remove order.subevent variants * various cleanup * Apply suggestions from code review Co-authored-by: Raphael Michel <mail@raphaelmichel.de> * remove empty docstrings * add depreciation warning * change event listener to pretix:bind-forms --------- Co-authored-by: Raphael Michel <michel@pretix.eu> Co-authored-by: Raphael Michel <mail@raphaelmichel.de>
This commit is contained in:
co-authored by
Raphael Michel
Raphael Michel
parent
f25c233e91
commit
7fe31634e6
@@ -94,14 +94,14 @@ class SubEventBulkForm(SubEventForm):
|
||||
label=_('Start of presale'),
|
||||
help_text=_('Optional. No products will be sold before this date.'),
|
||||
required=False,
|
||||
limit_choices=('date_from', 'date_to'),
|
||||
limit_choices=('event__date_from', 'event__date_to'),
|
||||
)
|
||||
rel_presale_end = RelativeDateTimeField(
|
||||
label=_('End of presale'),
|
||||
help_text=_('Optional. No products will be sold after this date. If you do not set this value, the presale '
|
||||
'will end after the end date of your event.'),
|
||||
required=False,
|
||||
limit_choices=('date_from', 'date_to'),
|
||||
limit_choices=('event__date_from', 'event__date_to'),
|
||||
)
|
||||
skip_if_overlap = forms.BooleanField(
|
||||
label=pgettext_lazy('subevent', 'Skip dates that overlap with any existing date'),
|
||||
@@ -333,12 +333,12 @@ class BulkSubEventItemForm(SubEventItemForm):
|
||||
rel_available_from = RelativeDateTimeField(
|
||||
label=_('Available from'),
|
||||
required=False,
|
||||
limit_choices=('date_from', 'date_to'),
|
||||
limit_choices=('event__date_from', 'event__date_to'),
|
||||
)
|
||||
rel_available_until = RelativeDateTimeField(
|
||||
label=_('Available until'),
|
||||
required=False,
|
||||
limit_choices=('date_from', 'date_to'),
|
||||
limit_choices=('event__date_from', 'event__date_to'),
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -355,12 +355,12 @@ class BulkSubEventItemVariationForm(SubEventItemVariationForm):
|
||||
rel_available_from = RelativeDateTimeField(
|
||||
label=_('Available from'),
|
||||
required=False,
|
||||
limit_choices=('date_from', 'date_to'),
|
||||
limit_choices=('event__date_from', 'event__date_to'),
|
||||
)
|
||||
rel_available_until = RelativeDateTimeField(
|
||||
label=_('Available_until'),
|
||||
required=False,
|
||||
limit_choices=('date_from', 'date_to'),
|
||||
limit_choices=('event__date_from', 'event__date_to'),
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user