forms.py
PERSON_ACTIONS = (
('1', '01.Allowed to rest and returned to class'),
('2', '02.Contacted parents /guardians'),
('3', '02a.- Unable to Contact'),
('4', '02b.Unavailable - left message'),)
class PersonActionsForm(forms.ModelForm):
action = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple(), choices=PERSON_ACTIONS, required=False, label= u"Actions")
models.py
class Actions(models.Model):
report = models.ForeignKey(Report)
action = models.IntegerField('Action type')
print.html
{{ actionform.as_p}}
The PersonActionsForm contains the items with multichoice checkbox.
In report registration page,the user can select any one or more item.The checked items are saved in models as integer values.
Since i am rendering the whole form it is showing the entire form with checked and unchecked item.
In print page,i want to show only the checked item alone without checkbox.
How to do this in django.
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…