Rufman wrote:
> hey guys
> 
> I need a little help reversing urls with a get parameter.
> 
> I'm using urlresolvers.reverse() in my view to reverse the url as
> follows:
> reverse(pageName, kwargs={'page' : page})
> 
> If i try passing thre request.GET object as so:
> 
> reverse(pageName, args=[request.GET], kwargs={'page' : page}
> 
> I get the url with the keyword arg but no get args.  Apparently it's
> wrong if I pass the request.GET object in args. Does anyone have a
> better idea.

Args and kwargs in reverse are needed to fill the placeholders in your 
url. If you have an urlpattern like this:

     (r'^objects/(\d+)/$', objects_view)

then you can construct a URL with reverse like this:

     reverse('objects_view', args=[obj.id])

... and obj.id will replace (\d+) part.

As for GET parameters, you don't need any special logic that would 
format them in some tricky way because they are uniform. You can just do 
this:

     reverse(pageName) + '?page=%s' % page

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