to be specific. the view renders this form in the template
<label for="id_members_0">Members</label>*: <br />
<ul>
<li><label for="id_members_0"><input checked="checked" type="checkbox"
name="members" value="1" id="id_members_0" /> test1</label></li>
<li><label for="id_members_1"><input checked="checked" type="checkbox"
name="members" value="2" id="id_members_1" /> test2</label></li>
<li><label for="id_members_2"><input checked="checked" type="checkbox"
name="members" value="3" id="id_members_2" /> test3</label></li>
<li><label for="id_members_3"><input type="checkbox" name="members"
value="4" id="id_members_3" /> test4</label></li>
<li><label for="id_members_4"><input type="checkbox" name="members"
value="5" id="id_members_4" /> test5</label></li>
<li><label for="id_members_5"><input checked="checked" type="checkbox"
name="members" value="6" id="id_members_5" /> test6</label></li>
<li><label for="id_members_6"><input type="checkbox" name="members"
value="7" id="id_members_6" /> test7</label></li>
<li><label for="id_members_7"><input checked="checked" type="checkbox"
name="members" value="8" id="id_members_7" /> test8</label></li>
<li><label for="id_members_8"><input checked="checked" type="checkbox"
name="members" value="9" id="id_members_8" /> test9</label></li>
</ul>
and I would like to have the option to get more information into
<label for="id_members_0"> so that there is not the text "test1" but
the full name of the user, for example.
On 29 Jan., 18:01, tom <[email protected]> wrote:
> Hi,
>
> I have a Model Form defined like that:
>
> class ProjectMemberForm(forms.ModelForm):
> """
> Renders a form where users can be assigned to a project.
> The ``members`` are overidden and need to be populated in the view
> with:
> form = ProjectMemberForm()
> form.base_fields['members'].queryset = ``SiteUser``
> """
> members = forms.ModelMultipleChoiceField(widget =
> forms.CheckboxSelectMultiple,
> # TODO: shall never be
> displayed, only used for testing. find a better solution
> queryset = None)
>
> class Meta:
> model = Project
> fields = ('members',)
>
> and I add the members to the form in a view:
> ProjectMemberForm.base_fields['members'].queryset = users
>
> the "users" are a queryset of django.contrib.auth.models.User objects
>
> this works fine and renders a form with the username, but I would like
> to display the full name of the user and other information out of the
> profile. Does anyone know how I can get to that information?
>
> cheers, Tom
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.