def signup(request): if request.method == 'POST': form = SignUpForm(request.POST) if not form.is_valid(): return render(request, 'auth/signup.html', {'form': form}) else: username = form.cleaned_data.get('username') email = form.cleaned_data.get('email') password = form.cleaned_data.get('password') User.objects.create_user(username=username, password=password, email=email) user = authenticate(username=username, password=password) django_login(request, user) return feeds(request) else: return render(request, 'auth/signup.html', {'form': SignUpForm()})
def signup(request): print request if request.method == 'POST': form = SignUpForm(request.POST) description = request.POST.get('description') language = request.POST.getlist('language') area = request.POST.get('area') gender = request.POST.get('gender') content = request.POST.get('content') birth_year_month = request.POST.get('birth_year_month') birth_year_day = request.POST.get('birth_year_day') birth_year_year = request.POST.get('birth_year_year') language_temp = "" for i in language:language_temp = language_temp + i + ',' print "description : %s " % description print "language : %s " % language print "area : %s " % area print "gender : %s " % gender print "birth_year_month : %s " % birth_year_month print "birth_year_day : %s " % birth_year_day print "birth_year_year : %s " % birth_year_year birth_day = datetime.datetime(int(birth_year_year), int(birth_year_month), int(birth_year_day), 00, 00, 00) if not form.is_valid(): return render(request, 'auth/signup.html', {'form': form}) else: username = form.cleaned_data.get('username') email = form.cleaned_data.get('email') password = form.cleaned_data.get('password') User.objects.create_user(username=username, password=password, email=email) user = authenticate(username=username, password=password) user.profile.self_introduction = description user.profile.language = language_temp user.profile.area = area user.profile.gender = gender user.profile.birthday = birth_day login(request, user) welcome_post = u'{0} さんがログインしました'.format(user.username, user.username) feed = Feed(user=user, post=welcome_post) feed.save() return redirect('/') else: return render(request, 'auth/signup.html', {'form': SignUpForm()})
def signup(request): if request.method == 'POST': form = SignUpForm(request.POST) if not form.is_valid(): return render(request, 'auth/signup.html', {'form': form}) else: username = form.cleaned_data.get('username') email = form.cleaned_data.get('email') password = form.cleaned_data.get('password') User.objects.create_user(username=username, password=password, email=email) user = authenticate(username=username, password=password) login(request, user) welcome_post = u'{0} has joined the network.'.format(user.username, user.username) feed = Feed(user=user, post=welcome_post) feed.save() return redirect('/') else: return render(request, 'auth/signup.html', {'form': SignUpForm()})
def signup(request): if request.method == 'POST': form = SignUpForm(request.POST) if not form.is_valid(): return render(request, 'auth/signup.html', {'form': form}) else: username = form.cleaned_data.get('username') email = form.cleaned_data.get('email') password = form.cleaned_data.get('password') User.objects.create_user(username=username, password=password, email=email) user = authenticate(username=username, password=password) login(request, user) welcome_post = u'{0} has joined the network.'.format( user.username, user.username) feed = Feed(user=user, post=welcome_post) feed.save() return redirect('/') else: return render(request, 'auth/signup.html', {'form': SignUpForm()})