Skip to content
Snippets Groups Projects

Resolve "extend worker class"

Merged Piotr Gawron requested to merge 183-extend-worker-class into master
1 file
+ 10
16
Compare changes
  • Side-by-side
  • Inline
@@ -8,26 +8,24 @@ from web.models import Appointment, Worker, AppointmentTypeLink, AppointmentType
from web.views.notifications import get_filter_locations
class AppointmentDetailForm(ModelForm):
class AppointmentForm(ModelForm):
datetime_when = forms.DateTimeField(label='Appointment on',
widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
)
class AppointmentDetailForm(AppointmentForm):
class Meta:
model = Appointment
fields = '__all__'
datetime_when = forms.DateTimeField(label='Appointment on (YYYY-MM-DD HH:MM)',
widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
)
class AppointmentEditForm(ModelForm):
class AppointmentEditForm(AppointmentForm):
class Meta:
model = Appointment
fields = '__all__'
exclude = ['appointment_types']
datetime_when = forms.DateTimeField(label='Appointment on (YYYY-MM-DD HH:MM)',
widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
)
def __init__(self, *args, **kwargs):
user = kwargs.pop('user', None)
if user is None:
@@ -87,15 +85,11 @@ class AppointmentEditForm(ModelForm):
return appointment
class AppointmentAddForm(ModelForm):
class AppointmentAddForm(AppointmentForm):
class Meta:
model = Appointment
exclude = ['status', 'appointment_types']
datetime_when = forms.DateTimeField(label='Appointment on (YYYY-MM-DD HH:MM)',
widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
)
def __init__(self, *args, **kwargs):
user = kwargs.pop('user', None)
if user is None:
@@ -132,4 +126,4 @@ class AppointmentAddForm(ModelForm):
for appointment_type in appointment_types:
appointment_type_link = AppointmentTypeLink(appointment=appointment, appointment_type=appointment_type)
appointment_type_link.save()
return appointment
\ No newline at end of file
return appointment
Loading