0
I created a file called const.py (where I have the options of Choices that I will call in the models) as follows::
const.
FORENSIC_TRAFFIC_LIGHTING = (
(u'1', u'Boa'),
(u'2', u'Ruim'),
(u'3', u'Ausente'),
)
py.models
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 html form.
<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 what I call these options in html! For example, I want you to appear with the radiobutton type in my form.html
Hello guys, thanks for the help!! Have a nice day :)!!
– Sara Fernandes