本文整理汇总了Python中profiles.models.Profile.profile_pic方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.profile_pic方法的具体用法?Python Profile.profile_pic怎么用?Python Profile.profile_pic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类profiles.models.Profile
的用法示例。
在下文中一共展示了Profile.profile_pic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: User_Profile_Registration
# 需要导入模块: from profiles.models import Profile [as 别名]
# 或者: from profiles.models.Profile import profile_pic [as 别名]
def User_Profile_Registration(request):
if request.user.is_authenticated():
return HttpResponseRedirect('/')
if request.method == 'POST':
form = RegistrationForm(request.POST, request.FILES)
if form.is_valid():
handle_uploaded_file(request.FILES['profile_pic'])
user = User.objects.create_user(username=form.cleaned_data['username'], email = form.cleaned_data['email'], password = form.cleaned_data['password'])
user.first_name = form.cleaned_data['first_name']
user.last_name=form.cleaned_data['last_name']
user.save()
profile = Profile(user = user, countries=form.cleaned_data['countries'], about_me = form.cleaned_data['about_me'], birth_date = form.cleaned_data['birth_date'])
profile.profile_pic=form.cleaned_data['profile_pic']
profile.save()
registredUser = authenticate(username = form.cleaned_data['username'], password= form.cleaned_data['password'])
if registredUser is not None:
login(request, registredUser)
return HttpResponseRedirect('/')
else:
return HttpResponseRedirect('/registered')
else:
form = RegistrationForm()
context = { 'form' : form }
return render_to_response('register.html', context, context_instance=RequestContext(request))
return HttpResponseRedirect('/')