예제 #1
0
파일: views.py 프로젝트: nitingera1996/pd
def next_step(request):
    u=request.user
    if request.method=="POST":
        up=UserProfile(user=u,level=1)
        name = request.POST.get('name')
        email = request.POST.get('email')
        dob_date = request.POST.get('dob_date')
        dob_month = request.POST.get('dob_month')
        dob_year = request.POST.get('dob_year')
        profile_pic_url=request.FILES['picture']
        print profile_pic_url
        languages=request.POST.get('language')
        profile_tagline=request.POST.get('profile_tag')
        liked_category_ids=request.POST.getlist('category')
        up.name=name
        up.dob_date=int(dob_date)
        up.dob_month=int(dob_month)
        up.dob_year=int(dob_year)
        up.languages=int(languages) 
        up.profile_tag_line=profile_tagline
        up.save()
        up_follow=Follow(userprofile=u)
        up_follow.save()
        return HttpResponseRedirect('/blogu/')
    else:
        #try:
           # up=UserProfile.objects.get(user=u)
           # return HttpResponseRedirect('/blogu/')
        #except:
        context_dict={}
        cat_list=Category.objects.all()
        context_dict['cat_list']=cat_list
        return render(request,'blogu/next_step.html',context_dict)