【发布时间】:2020-08-01 06:41:36
【问题描述】:
我想在用户注册时选择电话服务机构。但我的选择表单没有出现在 html 中。 有没有办法制作选择表格?
models.py
class User(AbstractUser):
...
phone_service_provider = models.CharField(
max_length=11, choices=AGENCY_CHOICES, blank=False
)
...
forms.py:
class SignUpGeneralForm(forms.Form):
...
address_postcode_general = forms.CharField(
widget=forms.TextInput(
attrs={
"id": "postcode",
"placeholder": "우편번호",
"class": "appearance-none bg-transparent border-none w-full text-gray-700 mr-3 py-1 px-2 leading-tight focus:outline-none",
"style": "width:100%; height:100%;",
"readonly": "true",
}
)
)
phone_service_provider = forms.ChoiceField(
widget=forms.Select(choices=AGENCY_CHOICES)
)
phone_number = forms.CharField(
widget=forms.TextInput(
attrs={
"placeholder": "핸드폰 번호",
"class": "appearance-none bg-transparent border-none w-full text-gray-700 mr-3 py-1 px-2 leading-tight focus:outline-none",
"style": "width:100%; height:100%;",
}
)
)
...
【问题讨论】:
标签: django django-models django-forms