models.py:
class Person(models.Model):
GENDER_SELECT = (
('f', 'Female'),
('m', 'Male'),
('o', 'Other'),
)
TITLE_SELECT = (
('0', 'Mr.'),
('1', 'Mrs.'),
('2', 'Ms.'),
('3', 'Mast.'),
)
title=models.CharField(max_length=5,choices=TITLE_SELECT)
name=models.CharField(max_length=100)
gender=models.CharField(max_length=11,choices=GENDER_SELECT)
forms.py:
class PersonForm(ModelForm):
class Meta:
model=Person
fields='__all__'
widgets={
'title': forms.RadioSelect(),
'gender': forms.RadioSelect(),
}
template:
<form action="" method="post">
{% csrf_token %}
{{form1.as_p}}
<input type="submit" value="Submit">
</form>
Output:
As you can see, the fields display as verticals whereas I want them horizontal. Plus, I don't want that initial '__________' choice. How can I achieve it?