On Mar 16, 3:08 am, django_jedi <pemaq...@gmail.com> wrote:
> > Assuming that 'groupA' is a model field, there's no such property as
> > 'selections.groupA', because as you've stated, selections is a
> > queryset - ie a collection of model instances, not a single one.
>
> > However in general you'd be better off using Django's forms framework,
> > which outputs fields for you with all the correct attributes selected.
> > --
> > DR.
>
> selections is a single record, obtained this way...
>
> selections =
> Workshop.objects.get(user__username=request.user.username)
>
> I have no trouble accessing/printing the value of selections.groupA
> (or selections.groupB, etc.) unless I'm inside the "for" loop that
> displays the Workshops (I'd like to highlight the workshops that the
> user has selected).
>
> selections.groupA is the id for the Workshop they've selected.
>
> The basic Django form didn't give me the interaction I was looking
> for.  I want people to use radio buttons to select one Workshop from
> among a group of five.  (That gets submitted as their Group A
> selection).

Don't see why you can't do that with Django forms.

class MyForm(forms.Form):
    group = forms.ModelChoiceField(queryset=Group.objects.all(),
empty_label=None, widget=forms.RadioSelect)

--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to