On Sat, May 17, 2008 at 6:11 PM, mwebs <[EMAIL PROTECTED]> wrote:
> I am using something like this:
>
> model.objects.filter(field = variable)
>
> Is it possible to pass the field that is used for the lookup
> dynamically, so that field is also a variable ?

It's python kwargs (keyword arguments). You can do this:

    dictionary = {field1: val1, field2: val2}
    model.objects.filter(**dictionary)

Ronny

--~--~---------~--~----~------------~-------~--~----~
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