Skip to content
Snippets Groups Projects
Commit 695d1141 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

length must be positive

parent f9c270b0
No related branches found
No related tags found
1 merge request!396Resolve "Appointment with 0 length can be added (question)"
Pipeline #48694 passed
......@@ -60,6 +60,8 @@ smasch (1.1.0~alpha.0-1) unstable; urgency=low
(#458)
* bug fix: validation for some configuration items did not exist (#456)
* bug fix: prevent fetching favicon - we don't have it (#304)
* bug fix: when adding/editing appointment length must be a positive value
(#464, 462)
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 25 Feb 2021 17:00:00 +0200
......
......@@ -25,8 +25,7 @@ class AppointmentForm(ModelForm):
datetime_when = forms.DateTimeField(label='Appointment on',
widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
)
length = forms.IntegerField(label='Appointment length (in minutes)',
min_value=0)
length = forms.IntegerField(label='Appointment length (in minutes)', min_value=1)
user: Worker
def __init__(self, *args, **kwargs):
......@@ -187,7 +186,6 @@ class AppointmentAddForm(AppointmentForm):
fields['worker_assigned'].widget.attrs = {'class': 'search_worker_availability'}
fields['datetime_when'].widget.attrs = {'class': 'start_date', 'placeholder': 'yyyy-mm-dd HH:MM',
'pattern': '[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}'}
fields['length'].widget.attrs = {'class': 'appointment_duration'}
self.fields = fields
self.fields['location'].queryset = self.user.locations
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment