Wednesday, April 1, 2015

Re: encode url

Why do you need it?

Web-browser encodes your data using Percent-encoding (http://en.wikipedia.org/wiki/Percent-encoding) by default. 

You may base64 your code on client side using JS and decode it on server side using python, but it seems useless for me. base64 is used to eliminate special chars, but percent-encoding helps your to escape special chars, so you do not need to worry about escaping. 

On Tuesday, March 31, 2015 at 7:43:14 PM UTC+3, Pnelson wrote:

Im trying to learn django and i have a form in html that have 3 arguments (app_id,user_id and username) and i want to encode those 3 arguments in base64.

views.py

def encode(self):          return base64.b64encode()    def decode(self):          return base64.b64decode()

login.html

<body>  <form action="/notification_html/" method="get">      Application ID: <input type="text" name="appid">      User ID: <input type="text" name="userid">      Username: <input type="text" name="username">      <input type="submit" value="Login">      <input type="reset" value="Reset">  </form>  </body>

URL created: http://127.0.0.1:8000/notification_html/?appid=1&userid=&username=1

Any suggestion to encode the url?

Thanks for help


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/727c8a7c-267e-4b1d-8418-7fdd421d31ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment