How to get rid of the bogus choice generated by RadioSelect of Django Form

后端 未结 5 1029
名媛妹妹
名媛妹妹 2021-01-02 03:48

I am using ModelForm on Django 1.3.

models.py:

class UserProfile(models.Model):
...
gender = models.CharField(max_length=1, blank=True, choices=((\'M         


        
5条回答
  •  无人及你
    2021-01-02 04:24

    You can set the choices when you set the widget. It's showing the ---- because in your model you have blank=True.

    Just use the choices arg of the widget and set it to the choices you set in your model.

提交回复
热议问题