On 2 Srp, 17:35, Nathan Ostgard <[EMAIL PROTECTED]> wrote:

> You can use ModelMultipleChoiceField for this:
>
> items =
> newforms.ModelMultipleChoiceField(queryset=Items.objects.all())

Hi Nathan,

I use it this way, but I need to reduce the queryset for current user
whom ID is contained in HTTP request. I'm a beginner, hence I
implemented it by nesting form's declaration into view function:

def my_view(request):

    class MyForm(forms.Form)
         emails = forms.ModelMultipleChoiceField(queryset=
              MyDBModel.objects.filter(user=request.user.id)


But I'd like to have form declaration out of this view na pass user's
ID as an argument - is there any way how to supply queryset in
runtime? I tried to assign queryset later to form's instance having no
success.

Thanks, Peter


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to