Chase,
> I'm trying to dynamically generate filter kwargs (in the form of
> strings) and feed them to a QuerySet, but the queryset wants nothing to
> do with it. Here's some simplified code:
>
> name = "joe-smith"
> string = "person__slug__exact"
> string += "=" + name
>
> qs = Person.objects.filter(string)
you have to create a python dictionary where the keys contain the
"field-filter spec" and the values are you "filter values". so in your
example you should do something like:
filter_kw = dict (person__slug__exact = "joe-smith")
or
filter_kw = {"person__slug__exact" = "joe-smith")
and
qs = Person.objects.filter(** filter_kw)
(I have not tried this but it should work that way)
Martin
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---