import urllibparameters = ({'langpair': '%s|%s' % (self.detected_language, 'en'),'v': '1.0','q': self.words_list.encode('utf-8') })urllib.urlencode(parameters)
Hello lista, I'm a newbie in django. In php i have the urlencode
function for encoding an url with characters "+","ñ","ó", .... Has
Django an urlencode or similar function?
Thanks for read, and sorry my bad english
P.D.: django 1,2.1
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
import urllib
urllib.quote("+ ñ ó")
'%2B%20%C3%B1%20%C3%B3'
Shawn
Regards,
Felix
refreegrata schrieb:
> Hello lista, I'm a newbie in django. In php i have the urlencode
> function for encoding an url with characters "+","�","�", .... Has
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
The url resolver takes care of all of this magic for you. If you find
it isn't, then you aren't using it right. For instance:
<a href="{% url mmm %}var/{{ var|urlencode }}/">link</a>
This is clearly an incorrect use of a url pattern. Instead, the var
argument should be included as part of the urlpattern, and var given
as an argument to the url template tag.
<a href="{% url mmm-with-var var %}">link</a>
Do it like this, and you won't have problems. If you need to generate
a query string, use the pattern as described by Alexandre González in
the first reply.
Cheers
Tom