Commit b41cede9 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

login_url helper

parent 8c8a565d
......@@ -34,6 +34,7 @@
import logging
import datetime
import time
import urllib
from urlparse import urlparse
from datetime import tzinfo, timedelta
......@@ -266,3 +267,11 @@ def model_to_dict(obj, exclude=['AutoField', 'ForeignKey', 'OneToOneField'],
tree[field_name] = value
return tree
def login_url(request):
attrs = {}
for attr in ['login', 'key', 'code']:
val = request.REQUEST.get(attr, None)
if val:
attrs[attr] = val
return "%s?%s" % (reverse('login'), urllib.urlencode(attrs))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment