adamspd / django-appointment

A Django app for managing appointment scheduling with ease and flexibility.
Apache License 2.0
125 stars 37 forks source link

Error at AppointmentForm class #226

Closed trid2q closed 1 month ago

trid2q commented 1 month ago
class AppointmentForm(forms.ModelForm):

File "/usr/local/lib/python3.10/site-packages/appointment/forms.py", line 43, in AppointmentForm phone = PhoneNumberField(widget=PhoneNumberPrefixWidget(initial='US')) TypeError: MultiWidget.init() got an unexpected keyword argument 'initial'

Version 3.6.0

Just change line 43 in forms.py FROM:

phone = PhoneNumberField(widget=PhoneNumberPrefixWidget(initial='US'))

TO:

phone = PhoneNumberField(widget=PhoneNumberPrefixWidget({'initial':'US'}))
adamspd commented 1 month ago

Hi @trid2q there's a similar issue about this error. Are you using the same version of PhoneNumber as stated in requirements.txt ?

trid2q commented 1 month ago

This issue caused by different version of django-phonenumber-field. When installing django-appointment 3.6.0, it automatically installs django-phonenumber-field 8.0.0 which causes issue. Django-phonenumber-field 7.3.0 specified in requirements.txt resolves it. So, I think we should either make django-appointment 3.6 install the right version or modify the code to use the update version of django-phonenumber-field. Thanks.

adamspd commented 1 month ago

I have identified that the issue originates from this line in the setup.cfg file. The use of >= causes the latest version to be downloaded, which is not desirable for our requirements.