|
8 | 8 |
|
9 | 9 | from django import forms
|
10 | 10 | from django.utils.translation import gettext as _
|
11 |
| -from phonenumber_field.formfields import PhoneNumberField, SplitPhoneNumberField |
12 |
| -from phonenumber_field.widgets import PhoneNumberPrefixWidget |
| 11 | +from phonenumber_field.formfields import SplitPhoneNumberField |
13 | 12 |
|
14 | 13 | from .models import (
|
15 | 14 | Appointment, AppointmentRequest, AppointmentRescheduleHistory, DayOff, Service, StaffMember,
|
|
21 | 20 |
|
22 | 21 | class SlotForm(forms.Form):
|
23 | 22 | selected_date = forms.DateField(validators=[not_in_the_past])
|
24 |
| - staff_member = forms.ModelChoiceField(StaffMember.objects.all(), error_messages={'invalid_choice': 'Staff member does not exist'}) |
| 23 | + staff_member = forms.ModelChoiceField(StaffMember.objects.all(), |
| 24 | + error_messages={'invalid_choice': 'Staff member does not exist'}) |
25 | 25 |
|
26 | 26 |
|
27 | 27 | class AppointmentRequestForm(forms.ModelForm):
|
@@ -49,25 +49,26 @@ class Meta:
|
49 | 49 | def __init__(self, *args, **kwargs):
|
50 | 50 | super().__init__(*args, **kwargs)
|
51 | 51 | self.fields['phone'].widget.attrs.update(
|
52 |
| - { |
53 |
| - 'placeholder': '1234567890' |
54 |
| - }) |
| 52 | + { |
| 53 | + 'placeholder': '1234567890' |
| 54 | + }) |
55 | 55 | self.fields['additional_info'].widget.attrs.update(
|
56 |
| - { |
57 |
| - 'rows': 2, |
58 |
| - 'class': 'form-control', |
59 |
| - }) |
| 56 | + { |
| 57 | + 'rows': 2, |
| 58 | + 'class': 'form-control', |
| 59 | + }) |
60 | 60 | self.fields['address'].widget.attrs.update(
|
61 |
| - { |
62 |
| - 'rows': 2, |
63 |
| - 'class': 'form-control', |
64 |
| - 'placeholder': '1234 Main St, City, State, Zip Code' |
65 |
| - }) |
| 61 | + { |
| 62 | + 'rows': 2, |
| 63 | + 'class': 'form-control', |
| 64 | + 'placeholder': '1234 Main St, City, State, Zip Code', |
| 65 | + 'required': 'true' |
| 66 | + }) |
66 | 67 | self.fields['additional_info'].widget.attrs.update(
|
67 |
| - { |
68 |
| - 'class': 'form-control', |
69 |
| - 'placeholder': 'I would like to be contacted by phone.' |
70 |
| - }) |
| 68 | + { |
| 69 | + 'class': 'form-control', |
| 70 | + 'placeholder': 'I would like to be contacted by phone.' |
| 71 | + }) |
71 | 72 |
|
72 | 73 |
|
73 | 74 | class ClientDataForm(forms.Form):
|
@@ -162,9 +163,9 @@ def __init__(self, *args, **kwargs):
|
162 | 163 | existing_staff_user_ids = StaffMember.objects.values_list('user', flat=True)
|
163 | 164 | # Filter queryset for user field to include only superusers or users not already staff members
|
164 | 165 | self.fields['user'].queryset = get_user_model().objects.filter(
|
165 |
| - is_superuser=True |
| 166 | + is_superuser=True |
166 | 167 | ).exclude(id__in=existing_staff_user_ids) | get_user_model().objects.exclude(
|
167 |
| - id__in=existing_staff_user_ids |
| 168 | + id__in=existing_staff_user_ids |
168 | 169 | )
|
169 | 170 |
|
170 | 171 |
|
|
0 commit comments