I have a situation where I want to do the following:
       take a bunch of POST params and from them create a Q object
       urlencode that Q object and turn it into a GET param, redirect
using that param
       process the GET that contains the urlencoded Q object, create a
Q object from it, and use it in a filter


I think this should all be possible, however, I am having trouble
recreating the new Q object from the string representation of the
original Q object. Here's an example of the problem:

>>> filter_orig = Q(owner__username='mlevine')
>>> print filter_orig
(AND: ('owner__username', 'mlevine'))
>>> filter_new = Q("%s" % orig)
>>> print filter_new
(AND: (AND: ('owner__username', 'mlevine')))
>>> Task.objects.filter(filter_orig)
[<Task: T1>, <Task: run initial timing>]
>>> Task.objects.filter(filter_new)
Traceback (most recent call last):
...
  File "/home/mlevine/django/django_libs/django-admin-ui-july8/lib/
python2.6/site-packages/django/db/models/sql/query.py", line 1520, in
add_filter
    arg, value = filter_expr


Note that in the above log, when I print filter_new, there is an extra
AND at the front.  Logically this shouldn't be be a problem, but I
suspect that it is indicative of the problem.

Is what I'm doing above supposed to work?  Is this a bug?

This is using 1.1 beta.

Margie



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