I've got a formset:
I've got a formset:
FormSet = inlineformset_factory(
User, Profile,
fields=('mychoice',),
widgets={
'mychoice': Select(choices=CHOICES)
},
labels={
'mychoice': _('mychoices:')
}
)
Instantiated in class based DetailView:
class ProfileDisplay(DetailView):
template_name = 'profile.html'
model = User
def get(self, request, *args, **kwargs):
form = self.get_form()
profile_form = ProfileFormSet(instance=self.request.user)
return self.render_to_response(
self.get_context_data(form=form, profile_form=profile_form)
)
and shown in a template like:
<form method="POST" action=".">
<fieldset class="profile">
{{ profile_form.management_form }}
{% for form in profile_form %}
{% for field in form %}
{{ field }}
{{ field.label_tag }}
{% endfor %}
{% endfor %}
</fieldset>
</form>
The problem is that label is not shown on the page, I'm getting only:
<select name="profile-0-mychoice" id="id_profile-0-mychoice">
<option value="True" selected>mychoice true</option>
<option value="False">mychoice false</option>
</select>
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/33f4cd73-913e-4beb-8a1b-3cb5b2c60edb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment