adamspd / django-appointment

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

Error at AppointmentForm class #226

Closed trid2q closed 3 months ago

trid2q commented 3 months 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 3 months 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 3 months 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 3 months 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.