Closed emdemir closed 10 months ago
That looks like a usability improvement, thanks for the suggestion! :+1:
I see that the form field already passes the region
to widgets that support it. It looks like RegionalPhoneNumberWidget
relies on it, so the change will likely be quite small.
Currently, the
region
value is passed from the model field to the form field, but it is not used after that. I wanted to make it so that theregion
value I added in the model field could be also used in thePhoneNumberPrefixWidget
as the default region selected, so for example the customer would see their own country selected by default but then they could select another country for international numbers. Would this be an okay addition? Seems like this would simply entail settingself.widget.region = region
in the formfield constructor. Alternatively we could pass it as part of theattrs
dict, but that would require a customBoundField
subclass as sadly formfields cannot directly influence widget attrs.I can create a PR if this is acceptable.