I created a file called const.py (where I have the choices I'll call in models) as follows:
const.py
FORENSIC_TRAFFIC_LIGHTING = (
(u'1', u'Boa'),
(u'2', u'Ruim'),
(u'3', u'Ausente'),
)
models.py
class ForensicTraffic(models.Model):
"""
Classe para modelagem
"""
lighting = models.CharField(
choices=const.FORENSIC_TRAFFIC_LIGHTING,
max_length=1,
verbose_name='Iluminação'
)
Here's a piece of form.html
<div class="row">
<div class="col-xs-4">
<label>{{traffic_form.lighting.label }}</label>
<div class="radio">
<input type="radio" name="optionsRadiosLighting" id="optionsRadiosBoa" value="option1" checked>
<label for="optionsRadiosBoa">Boa</label>
</div>
<div class="radio">
<input type="radio" name="optionsRadiosLighting" id="optionsRadiosRuim" value="option2">
<label for="optionsRadiosRuim">Ruim</label>
</div>
<div class="radio">
<input type="radio" name="optionsRadiosLighting" id="optionsRadiosAusente" value="option3">
<label for="optionsRadiosAusente">Ausente</label>
</div>
</div>
</div>
I would like to know how I call these options in html! For example, I want it to appear with the radioButton type in my form.html