2021年3月20日星期六

Styling PhoneNumberPrefixWidget in django with crispyforms

I'm rendering a crispy form and I've added a PhoneNumberPrefixWidget from this library, after adding it to crispy form's layout I can't change the style. Is there any way to achieve this? The library owns almost any documentation.

My model:

class Contact(BaseModel):      person_phone_number = PhoneNumberField(          verbose_name="Número de teléfono", null=True, blank=True      )  

Form:

class ContactForm(BaseForm):      person_phone_number = PhoneNumberField(          widget=PhoneNumberPrefixWidget(initial="IN"),          label=('Número de Teléfono'),      )        class Meta:          model = Contact          exclude = []    

Layout:

self.layout.fields.append(              self.make_row(                  [                      "person_phone_number",                  ],                  size=6,              )          )  
https://stackoverflow.com/questions/66728461/styling-phonenumberprefixwidget-in-django-with-crispyforms March 21, 2021 at 11:06AM

没有评论:

发表评论