Fix #274 -- Disable weekends in datetimepicker for expiry (#320)

* Fix for Disable weekends in datetimepicker for expiry #274

* minor fixes from review
This commit is contained in:
Christopher Dambamuromo
2016-11-17 21:39:48 +00:00
committed by Raphael Michel
parent 94461b36ba
commit bac9960d0c
5 changed files with 15 additions and 4 deletions

View File

@@ -27,10 +27,14 @@ def contextprocessor(request):
_html_head.append(response)
ctx['html_head'] = "".join(_html_head)
_js_payment_weekdays_disabled = '[]'
_nav_event = []
if hasattr(request, 'event'):
for receiver, response in nav_event.send(request.event, request=request):
_nav_event += response
if request.event.settings.get('payment_term_weekdays'):
_js_payment_weekdays_disabled = '[0,6]'
ctx['js_payment_weekdays_disabled'] = _js_payment_weekdays_disabled
ctx['nav_event'] = _nav_event
ctx['js_datetime_format'] = get_javascript_format('DATETIME_INPUT_FORMATS')

View File

@@ -13,7 +13,10 @@ class ExtendForm(I18nModelForm):
model = Order
fields = ['expires']
widgets = {
'expires': forms.DateInput(attrs={'class': 'datepickerfield'}),
'expires': forms.DateInput(attrs={
'class': 'datepickerfield',
'data-is-payment-date': 'true'
})
}
def clean(self):

View File

@@ -35,7 +35,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="{% static "pretixbase/img/favicon.ico" %}">
</head>
<body data-datetimeformat="{{ js_datetime_format }}" data-dateformat="{{ js_date_format }}" data-datetimelocale="{{ js_locale }}">
<body data-datetimeformat="{{ js_datetime_format }}" data-dateformat="{{ js_date_format }}" data-datetimelocale="{{ js_locale }}" data-payment-weekdays-disabled="{{ js_payment_weekdays_disabled }}">
<div id="#wrapper">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="navbar-header">