On Sat, 2009-02-21 at 15:37 -0800, Guri wrote:
> Hi,
>           I need help in solving two small problems.
> 
> 1.  A form submitted, after validation calls HttpResponseRedirect
> (reverse('view.get_links',args=(request.POST['data'])))
> 
> In url pattern
> (r'^links/(?P<tname>.*)/',get_links),
> 
> I am trying to send one more argument along with "request.POST
> ['data']" but it should not be part of pattern matching in URL.
> I tried adding it in args tuple and same arg in my view and I get this
> error:
> AttributeError at /links/dsf/
> 'str' object has no attribute '_clone'

*How* did you try to add it? You show us the error message, but not what
you did to cause it. I don't understand what you are trying to do
(request.POST has nothing to do with URL parsing, so I'm not sure if
you're trying to do something impossible or if that's an unrelated
thing), but showing what you attempted would provide some clues.

> 
> 2. Another issue is I am trying to make a queryset using a loop
> something like
> for tag in tag_str:
>         qs = qs & Tags.objects.filter(tag_name__exact = tag)
> 
>         return list_detail.object_list(request.....querset=qs,...)
> Please tell me if this is somewhere near correct?

It depends upon what you're trying to do. Is it syntactically and
API-wise correct? Looks about right. Will it achieve what you're
wanting? Only you know that, since you haven't explained the problem
you're trying to solve.

Reverse-engineering that little code fragment, it will add constraints
to the queryset so that all returned results must have tags with names
matching each of the names you pass in. If that's the goal, then you've
achieved it.

Regards,
Malcolm



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