本文整理汇总了Python中apps.reader.forms.SignupForm.save方法的典型用法代码示例。如果您正苦于以下问题:Python SignupForm.save方法的具体用法?Python SignupForm.save怎么用?Python SignupForm.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apps.reader.forms.SignupForm
的用法示例。
在下文中一共展示了SignupForm.save方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: import_signup
# 需要导入模块: from apps.reader.forms import SignupForm [as 别名]
# 或者: from apps.reader.forms.SignupForm import save [as 别名]
def import_signup(request):
if request.method == "POST":
signup_form = SignupForm(prefix='signup', data=request.POST)
if signup_form.is_valid():
new_user = signup_form.save()
user_token = None
if not user_token:
user_uuid = request.COOKIES.get('newsblur_reader_uuid')
if user_uuid:
user_token = OAuthToken.objects.filter(uuid=user_uuid).order_by('-created_date')
if not user_token:
if request.session.session_key:
user_token = OAuthToken.objects.filter(session_id=request.session.session_key).order_by('-created_date')
if not user_token:
user_token = OAuthToken.objects.filter(remote_ip=request.META['REMOTE_ADDR']).order_by('-created_date')
if user_token:
user_token = user_token[0]
user_token.session_id = request.session.session_key
user_token.user = new_user
user_token.save()
login_user(request, new_user)
return HttpResponseRedirect(reverse('index'))
else:
logging.user(request, "~BR~FW ***> Can't find user token during import/signup. Re-authenticating...")
return HttpResponseRedirect(reverse('google-reader-authorize'))
else:
signup_form = SignupForm(prefix='signup')
return render_to_response('import/signup.xhtml', {
'signup_form': signup_form,
}, context_instance=RequestContext(request))
示例2: signup
# 需要导入模块: from apps.reader.forms import SignupForm [as 别名]
# 或者: from apps.reader.forms.SignupForm import save [as 别名]
def signup(request):
if request.method == "POST":
form = SignupForm(prefix="signup", data=request.POST)
if form.is_valid():
new_user = form.save()
login_user(request, new_user)
logging.info(" ---> [%s] ~FG~SB~BBNEW SIGNUP~FW" % new_user)
return HttpResponseRedirect(reverse("index"))
return index(request)
示例3: signup
# 需要导入模块: from apps.reader.forms import SignupForm [as 别名]
# 或者: from apps.reader.forms.SignupForm import save [as 别名]
def signup(request):
if request.method == "POST":
form = SignupForm(prefix='signup', data=request.POST)
if form.is_valid():
new_user = form.save()
login_user(request, new_user)
logging.user(new_user, "~FG~SB~BBNEW SIGNUP~FW")
return HttpResponseRedirect(reverse('index'))
return index(request)
示例4: signup
# 需要导入模块: from apps.reader.forms import SignupForm [as 别名]
# 或者: from apps.reader.forms.SignupForm import save [as 别名]
def signup(request):
code = -1
if request.method == "POST":
form = SignupForm(data=request.POST)
if form.is_valid():
new_user = form.save()
login_user(request, new_user)
logging.user(new_user, "~FG~SB~BBAPI NEW SIGNUP~FW")
code = 1
return dict(code=code)
示例5: signup
# 需要导入模块: from apps.reader.forms import SignupForm [as 别名]
# 或者: from apps.reader.forms.SignupForm import save [as 别名]
def signup(request):
if request.method == 'POST':
form = SignupForm(prefix='signup', data = request.POST)
if form.is_valid():
new_user = form.save()
login_user(request, new_user)
logging.user(new_user, "~FG~SB~BBNEW SIGNUP: ~FW%s" % new_user.email)
if not new_user.is_active:
url = "https://%s%s" % (Site.objects.get_current().domain,
reverse('stripe-form'))
return HttpResponseRedirect(url)
return index(request)
示例6: signup
# 需要导入模块: from apps.reader.forms import SignupForm [as 别名]
# 或者: from apps.reader.forms.SignupForm import save [as 别名]
def signup(request):
form = SignupForm()
if request.method == "POST":
form = SignupForm(data=request.POST)
if form.is_valid():
new_user = form.save()
login_user(request, new_user)
logging.user(new_user, "~FG~SB~BBNEW SIGNUP~FW")
new_user.profile.activate_free()
return HttpResponseRedirect(request.POST['next'] or reverse('index'))
return render_to_response('accounts/signup.html', {
'form': form,
'next': request.REQUEST.get('next', "")
}, context_instance=RequestContext(request))
示例7: signup
# 需要导入模块: from apps.reader.forms import SignupForm [as 别名]
# 或者: from apps.reader.forms.SignupForm import save [as 别名]
def signup(request):
code = -1
errors = None
if request.method == "POST":
form = SignupForm(data=request.POST)
if form.errors:
errors = form.errors
if form.is_valid():
new_user = form.save()
login_user(request, new_user)
logging.user(request, "~FG~SB~BBAPI NEW SIGNUP~FW")
code = 1
else:
errors = dict(method="Invalid method. Use POST. You used %s" % request.method)
return dict(code=code, errors=errors)
示例8: signup
# 需要导入模块: from apps.reader.forms import SignupForm [as 别名]
# 或者: from apps.reader.forms.SignupForm import save [as 别名]
def signup(request):
form = SignupForm()
if request.method == "POST":
form = SignupForm(data=request.POST)
if form.is_valid():
new_user = form.save()
login_user(request, new_user)
logging.user(new_user, "~FG~SB~BBNEW SIGNUP~FW")
new_user.profile.activate_free()
return HttpResponseRedirect(request.POST["next"])
return render_to_response(
"accounts/signup.html",
{"form": form, "next": request.REQUEST.get("next", "")},
context_instance=RequestContext(request),
)
示例9: signup
# 需要导入模块: from apps.reader.forms import SignupForm [as 别名]
# 或者: from apps.reader.forms.SignupForm import save [as 别名]
def signup(request):
code = -1
errors = None
ip = request.META.get('HTTP_X_FORWARDED_FOR', None) or request.META['REMOTE_ADDR']
if request.method == "POST":
form = SignupForm(data=request.POST)
if form.errors:
errors = form.errors
if form.is_valid():
try:
new_user = form.save()
login_user(request, new_user)
logging.user(request, "~FG~SB~BBAPI NEW SIGNUP: ~FW%s / %s" % (new_user.email, ip))
code = 1
except forms.ValidationError, e:
errors = [e.args[0]]
示例10: signup
# 需要导入模块: from apps.reader.forms import SignupForm [as 别名]
# 或者: from apps.reader.forms.SignupForm import save [as 别名]
def signup(request):
code = -1
errors = None
ip = request.META.get('HTTP_X_FORWARDED_FOR', None) or request.META['REMOTE_ADDR']
if request.method == "POST":
form = SignupForm(data=request.POST)
if form.errors:
errors = form.errors
if form.is_valid():
new_user = form.save()
login_user(request, new_user)
logging.user(request, "~FG~SB~BBAPI NEW SIGNUP: ~FW%s / %s" % (new_user.email, ip))
code = 1
else:
errors = dict(method="Invalid method. Use POST. You used %s" % request.method)
return dict(code=code, errors=errors)
示例11: import_signup
# 需要导入模块: from apps.reader.forms import SignupForm [as 别名]
# 或者: from apps.reader.forms.SignupForm import save [as 别名]
def import_signup(request):
ip = request.META.get("HTTP_X_REAL_IP", None) or request.META.get("REMOTE_ADDR", "")
if request.method == "POST":
signup_form = SignupForm(prefix="signup", data=request.POST)
if signup_form.is_valid():
new_user = signup_form.save()
user_token = OAuthToken.objects.filter(user=new_user)
if not user_token:
user_uuid = request.COOKIES.get("newsblur_reader_uuid")
if user_uuid:
user_token = OAuthToken.objects.filter(uuid=user_uuid).order_by("-created_date")
if not user_token:
if request.session.session_key:
user_token = OAuthToken.objects.filter(session_id=request.session.session_key).order_by(
"-created_date"
)
if not user_token:
user_token = OAuthToken.objects.filter(remote_ip=ip).order_by("-created_date")
if user_token:
user_token = user_token[0]
user_token.session_id = request.session.session_key
user_token.user = new_user
user_token.save()
login_user(request, new_user)
if request.user.profile.is_premium:
return HttpResponseRedirect(reverse("index"))
url = "https://%s%s" % (Site.objects.get_current().domain, reverse("stripe-form"))
return HttpResponseRedirect(url)
else:
logging.user(request, "~BR~FW ***> Can't find user token during import/signup. Re-authenticating...")
return HttpResponseRedirect(reverse("google-reader-authorize"))
else:
signup_form = SignupForm(prefix="signup")
return render_to_response(
"import/signup.xhtml", {"signup_form": signup_form}, context_instance=RequestContext(request)
)
示例12: import_signup
# 需要导入模块: from apps.reader.forms import SignupForm [as 别名]
# 或者: from apps.reader.forms.SignupForm import save [as 别名]
def import_signup(request):
ip = request.META.get('HTTP_X_FORWARDED_FOR', None) or request.META.get('REMOTE_ADDR', "")
if request.method == "POST":
signup_form = SignupForm(prefix='signup', data=request.POST)
if signup_form.is_valid():
new_user = signup_form.save()
user_token = OAuthToken.objects.filter(user=new_user)
if not user_token:
user_uuid = request.COOKIES.get('pytune_reader_uuid')
if user_uuid:
user_token = OAuthToken.objects.filter(uuid=user_uuid).order_by('-created_date')
if not user_token:
if request.session.session_key:
user_token = OAuthToken.objects.filter(session_id=request.session.session_key).order_by('-created_date')
if not user_token:
user_token = OAuthToken.objects.filter(remote_ip=ip).order_by('-created_date')
if user_token:
user_token = user_token[0]
user_token.session_id = request.session.session_key
user_token.user = new_user
user_token.save()
login_user(request, new_user)
if request.user.profile.is_premium:
return HttpResponseRedirect(reverse('index'))
url = "https://%s%s" % (Site.objects.get_current().domain,
reverse('stripe-form'))
return HttpResponseRedirect(url)
else:
logging.user(request, "~BR~FW ***> Can't find user token during import/signup. Re-authenticating...")
return HttpResponseRedirect(reverse('google-reader-authorize'))
else:
signup_form = SignupForm(prefix='signup')
return render_to_response('import/signup.xhtml', {
'signup_form': signup_form,
}, context_instance=RequestContext(request))
示例13: import_signup
# 需要导入模块: from apps.reader.forms import SignupForm [as 别名]
# 或者: from apps.reader.forms.SignupForm import save [as 别名]
def import_signup(request):
if request.method == "POST":
signup_form = SignupForm(prefix='signup', data=request.POST)
if signup_form.is_valid():
new_user = signup_form.save()
try:
user_token = OAuthToken.objects.get(session_id=request.session.session_key)
except OAuthToken.DoesNotExist:
user_tokens = OAuthToken.objects.filter(remote_ip=request.META['REMOTE_ADDR']).order_by('-created_date')
if user_tokens:
user_token = user_tokens[0]
user_token.session_id = request.session.session_key
user_token.save()
user_token.user = new_user
user_token.save()
login_user(request, new_user)
return HttpResponseRedirect(reverse('index'))
else:
signup_form = SignupForm(prefix='signup')
return render_to_response('import/signup.xhtml', {
'signup_form': signup_form,
}, context_instance=RequestContext(request))