How to get rid of the bogus choice generated by RadioSelect of Django Form
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.
Set blank=False
(or just remove it) and also add default='Unspecified'
Even without blank=True it shows the extra input. I have created a new Widget:
from itertools import chain
from django.forms import RadioSelect
from django.utils.encoding import force_unicode
class RadioSelectNotNull(RadioSelect):
def get_renderer(self, name, value, attrs=None, choices=()):
"""Returns an instance of the renderer."""
if value is None: value = ''
str_value = force_unicode(value) # Normalize to string.
final_attrs = self.build_attrs(attrs)
choices = list(chain(self.choices, choices))
if choices[0][0] == '':
choices.pop(0)
return self.renderer(name, str_value, final_attrs, choices)