How can I make the radio select required?
The only way I can think of now is to overwrrite
my_list_choices = ( (1,'Yes'),(0,'No'),)
widgets = {
'my_radio_field' : forms.RadioSelect(choices=my_list_choices),
}
edit:
My model is as follows
class MyModel(models.Model):
name = models.CharField(max_length=32, blank=True, verbose_name='name')
bool_a = models.BooleanField(blank=False, verbose="bool")
I am trying to create a required radio box YES/NO to populate bool_a
Unless I’m much mistaken, when using a form, you can have the form.is_valid() check in your views.
I have a site where this goes down and have a file field as well as radio widget. If I don’t select one of them (or both) and press submit, the page reloads and prints out the error (field required).
Helpful?