def signup_form(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() # completed sign up username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username, password=password) login(request, user) # Create data in profile table for user current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/users/user.png" data.save() messages.success(request, 'Your account has been created!') return HttpResponseRedirect('/') else: messages.warning(request, form.errors) return HttpResponseRedirect('/signup') form = SignUpForm() setting = Setting.objects.get(pk=1) category = Category.objects.all() context = {'setting': setting, 'category': category, 'form': form} return render(request, 'signup.html', context)
def adduserprofile(request): setting = Setting.objects.get(pk=1) if request.method == 'POST': form2 = UserProfileForm(request.POST, request.FILES) if form2.is_valid(): current_user = request.user data2 = UserProfile() data2.user_id = current_user.id data2.phone = form2.cleaned_data['phone'] data2.address = form2.cleaned_data['address'] data2.city = form2.cleaned_data['city'] data2.country = form2.cleaned_data['country'] data2.image = form2.cleaned_data['image'] data2.save() messages.success(request, 'Your Content Inserted Succesfully') return HttpResponseRedirect('/user') else: messages.warning(request, 'Content Form Error : ' + str(form2.errors)) return HttpResponseRedirect('/user/useraddprofile') else: category = Categories.objects.all() menu = Menu.objects.all() form = UserProfileForm() context = { 'category': category, 'menu': menu, 'form': form, 'setting': setting, } return render(request, 'user_userprofile.html', context)
def signup_view(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username, password=password) login(request, user) # create data in profile table for user current_user = request.user data = UserProfile() data.user_id = current_user.id data.save() messages.success(request, "Hoş geldiniz..") return HttpResponseRedirect('/') form = SignUpForm() category = Category.objects.all() setting = Setting.objects.get(pk=1) context = { 'setting': setting, 'page': 'signup', 'category': category, 'form': form, } return render(request, 'signup.html', context)
def signup_view(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username, password=password) login(request, user) #create data in profile table for user current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/users/user.png" data.save() messages.success(request, "Hoş Geldiniz.. Kendi ev kiralama siteme başarılı bir şekilde üye oldunuz.İyi gezinmeler dilerim.") return HttpResponseRedirect('/') form = SignUpForm() category = Category.objects.all() context = { 'category': category, 'form': form, } return render(request, 'signup.html', context)
def signup_view(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = request.POST['username'] password = request.POST['password1'] user = authenticate(request, username=username, password=password) login(request, user) current_user = request.user data = UserProfile() data.user_id = current_user.id data.photo = "images/users/user.png" data.save() return HttpResponseRedirect('/') else: pass1 = request.POST['password1'] pass2 = request.POST['password2'] if pass1 != pass2: messages.warning(request, "Girilen şifreler eşleşmiyor.") return HttpResponseRedirect('/signup') else: messages.warning(request, "Üyelik Oluşturulurken Bir Hata Oluştu") return HttpResponseRedirect('/signup') form = SignUpForm() category = Category.objects.all() context = {'category': category, 'form': form, } return render(request, 'signup.html', context)
def signup_view(request): setting = Setting.objects.get(pk=1) if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username, password=password) login(request, user) #User profile tablosunu beraberinde oluştur current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/user/user.png" data.save() messages.success(request, "Hesabınız başarıyla oluşturuldu.") return HttpResponseRedirect('/') form = SignUpForm() category = Category.objects.all() last_posts = Post.objects.filter(status=True).order_by('-id')[:4] context = { 'setting': setting, 'category': category, 'form': form, 'last_posts': last_posts, } return render(request, 'signup.html', context)
def new_account_view(request): if request.method == 'POST': # Eğer form POST edildi ise form = NewaccountForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username, password=password) login(request, user) current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/users/user-ico.png" data.save() messages.success(request, "Kullanıcı Başarılı bir şekilde oluşturuldu") return HttpResponseRedirect('/') form = NewaccountForm() category = Category.objects.filter(status=True) context = { 'category': category, 'form': form, } return render(request, 'New_account.html', context)
def signup_view(request): setting = Setting.objects.get(pk=1) if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(request, username=username, password=password) login(request, user) current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = 'images/users/user.png' data.save() messages.success( request, "Hoş geldiniz... Sitemize başarılı bir şekilde üye oldunuz. İyi alışverişler dileriz." ) return HttpResponseRedirect('/') form = SignUpForm() category = Category.objects.all() context = { 'category': category, 'form': form, 'setting': setting, } return render(request, 'signup.html', context)
def signup_view(request): if request.method == 'POST': # Form post edildiyse form = SignUpForm(request.POST) if form.is_valid(): #formun şartlarına bakılıyor,şifreler uyuyor mu vb form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username, password=password) login(request, user) current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/users/user.png" data.save() messages.success(request, "Üyeliğininz Tamamlandı..") return HttpResponseRedirect('/') form = SignUpForm() category = Category.objects.all() context = { 'category': category, 'form': form, } return render(request, 'signup.html', context)
def signup_view(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username, password=password) login(request, user) current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/users/user.png" data.email = form.cleaned_data.get('email') data.phone = form.cleaned_data.get('phone') data.biography = form.cleaned_data.get('biography') data.facebook = form.cleaned_data.get('facebook') data.contact_detail = form.cleaned_data.get('contact_detail') data.skype = form.cleaned_data.get('skype') data.save() return HttpResponseRedirect('/') form = SignUpForm() category = Category.objects.all() setting = Setting.objects.get(pk=1) context = {'category': category, 'form': form, 'setting': setting} return render(request, 'signup.html', context)
def join_view(request): if request.method == 'POST': form = Signupform(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(request, username=username, password=password) login(request, user) current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = 'images/users/bos.png' data.save() return HttpResponseRedirect("/") else: messages.warning( request, "Kayıt Başarısız. Lütfen alanları kontrol ederek giriniz.") return HttpResponseRedirect('/join') form = Signupform() ayar = Ayarlar.objects.get(pk=1) categori = Categori.objects.filter(tip="categori") menu = Categori.objects.filter(tip="menu") menu_icerik = Urun.objects.filter(tip="menu") context = { 'ayar': ayar, 'categori': categori, 'form': form, 'menu': menu, 'menu_icerik': menu_icerik, } return render(request, 'join.html', context)
def signup_view(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = request.POST['username'] password = request.POST['password1'] user = authenticate(request, username=username, password=password) login(request, user) current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/users/user.jpg" data.save() messages.success( request, "Hoşgeldiniz...Sistemimize başarılı bir şekilde üye oldunuz.") return HttpResponseRedirect('/') form = SignUpForm() category = Category.objects.all() context = { 'category': category, 'form': form, } return render(request, 'signup.html', context)
def kayit_view(request): if request.method == 'POST': form = KayitForm(request.POST) # form ile bağlantı if form.is_valid( ): # burda if else yapmamıza gerek yok zaten kaydedilen yollanıyor.Validation yapılıyor burda. form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username, password=password) login(request, user) # auto login current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/users/user.png" data.save() return HttpResponseRedirect('/') form = KayitForm() category = Category.objects.all() context = { 'category': category, 'form': form, } return render(request, 'kayit.html', context) # html i açma
def signupView(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username, password=password) login(request, user) current_user = request.user data = UserProfile() data.user_id = current_user.id #data.image="images/users/user.png" data.save() messages.success(request, 'Üye kaydınız başarılı!') return HttpResponseRedirect("/") else: messages.warning(request, 'Bilgilerinizde hata var!') return HttpResponseRedirect('/signup/') form = SignUpForm() category = Category.objects.all() context = { 'category': category, 'form': form, } return render(request, 'customer-register.html', context)
def signup_view(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(request, username=username, password=password) login(request, user) current_user = request.user data = UserProfile( ) #kişi kayıt olduğunda otomatik profile oluşturmak için data.user_id = current_user.id data.image = "images/user.jpg" data.phone = 123456789 data.save() messages.success(request, "Sisteme başarılı bir şekilde kaydoldunuz") return HttpResponseRedirect('/') else: messages.error(request, "Hata. ") return HttpResponseRedirect('/signup') form = SignUpForm() category = Category.objects.all() setting = Setting.objects.get(pk=1) context = {'category': category, 'form': form, 'setting': setting} return render(request, 'signup.html', context)
def signup_view(request): if request.method == 'POST': form=SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username,password=password) login(request, user) current_user=request.user data=UserProfile() data.user_id=current_user.id data.image="images/users/user.png" data.save() messages.success(request, "Kayıt Gerçekleşti!") return HttpResponseRedirect('/') setting = Setting.objects.get(pk=1) form = SignUpForm() category = Category.objects.all() menu = Menu.objects.all() context = { 'category': category, 'form' : form, 'menu': menu, 'setting': setting, } return render(request, 'signup.html', context)
def signup_view(request): if request.method == 'POST': form = SignUpForm(request.POST) #formumuzu signup ile ilişkilendirdik. if form.is_valid( ): #valid kontrolü yaptık. şifre vs. uymuyorsa kurallara buna takılıyor. form.save( ) #kurallar dolu mu boş mu şifreler aynı mı uyuyor mu vs. dorm.save ile tüm elemanları alıp eşleştirdik. #return HttpResponse("Üye kaydedildi.") #kontrol ettim. username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username, password=password) login(request, user) #Create data in profile table for user current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/user/user.png" data.save() messages.success( request, "Hoş Geldiniz.. Sitemize başarılı bir şekilde üye oldunuz. İyi yolculuklar dileriz." ) return HttpResponseRedirect('/') form = SignUpForm() category = Category.objects.all() context = { 'category': category, 'form': form, } return render(request, 'signup.html', context)
def signup_view(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(request, username=username, password=password) login(request, user) current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/users/user.png" data.save() messages.success( request, "Hoş Geldiniiz,Başarılı bir şeklilde kayıt oldunuz.") return HttpResponseRedirect('/') form = SignUpForm() category = Category.objects.all() context = { 'category': category, 'form': form, } return render(request, 'signup.html', context)
def signup_view(request): if request.method == 'POST': form = RegisterForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username, password=password) login(request, user) current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/users/user.png" data.save() messages.success(request, "Üye olundu,Hoşgeldiniz!") return HttpResponseRedirect('/user') else: messages.warning(request, "Bu kullanıcı adı veya email kullanılıyor!") form = RegisterForm() category = Category.objects.all() menu = Menu.objects.all() context = {'category': category, 'form': form, 'menu': menu} return render(request, 'signup.html', context)
def signup_view(request): if request.method == 'POST': # check form post form = SignUpForm(request.POST) if form.is_valid( ): #if else yapmıyoruz burada validation zaten uygun mu değil mi kontrol ediyor her şeyi form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username, password=password) login(request, user) #Create data in profile table for user current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/users/user.png" data.save() messages.success(request, "Hoşgeldiniz!") # tek kullanımlık mesaj alanı return HttpResponseRedirect("/") form = SignUpForm() menu = Menu.objects.all() context = { 'menu': menu, 'form': form, } return render(request, 'signup.html', context)
def signup_view(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data['username'] password = form.cleaned_data['password1'] user = authenticate(username=username, password=password) login(request, user) current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/users/user.png" data.save() return HttpResponseRedirect('/') form = SignUpForm() category = Category.objects.all() context = {'category': category, 'form': form, } return render(request, 'signup.html', context)
def join_view(request): setting = Setting.objects.get(pk=1) if request.method == 'POST': form = JoinForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(request, username=username, password=password) login(request, user) current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = 'images/users/manager.png' data.save() messages.success( request, "Hoş Geldin. Spor yapmak için harika bir gün değil mi?") return HttpResponseRedirect('/') form = JoinForm() category = Category.objects.all() context = { 'category': category, 'form': form, 'setting': setting, } return render(request, 'join.html', context)
def signup_view(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(request, username=username, password=password) login(request, user) current_user = request.user data = UserProfile() data.user_id = current_user.id data.save() messages.success(request, "Welcome... Registering is successfuly.") return HttpResponseRedirect('/') form = SignUpForm() context ={ 'form': form } return render(request, 'signup.html', context)
def signup_view(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = request.POST['username'] password = request.POST['password1'] user = authenticate(request, username=username, password=password) login(request, user) #create user profile current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/users/indir.jpg" data.save() messages.success(request, "Hoşgeldiniz ! Başarıyla üye oldunuz...") return HttpResponseRedirect('/') if request.user.is_authenticated: current_user = request.user profile = UserProfile.objects.get(user_id=current_user.id) form = SignUpForm() category = Category.objects.all() context = { 'category': category, 'form': form, 'profile': profile, } else: form = SignUpForm() category = Category.objects.all() context = { 'category': category, 'form': form, } return render(request, 'signup.html', context)
def signup_view(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(request, username=username, password=password) login(request, user) #PROFİL TABLOSUNuDA OLUŞTUR current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/users/user.png" data.save() messages.success(request, "üye oldunuz süpersiniz!!!!!!") return HttpResponseRedirect('/') form = SignUpForm() category = Category.objects.all() context = { 'category': category, 'form': form, } return render(request, 'signup.html', context)
def register_view(request): if request.method == 'POST': form = RegisterForm(request.POST) if form.is_valid(): form.save() username = request.POST['username'] password = request.POST['password1'] user = authenticate(request, username=username, password=password) login(request, user) current_user = request.user data = UserProfile() data.user_id = current_user.id data.save() return HttpResponseRedirect('/') form = RegisterForm() setting = Settings.objects.get(pk=1) bimage = Accommodation.objects.get(pk=1) context = { 'setting': setting, 'bimage': bimage, 'form': form, } return render(request, 'register.html', context)
def sign_up_view(request): if request.method == 'POST': form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(request, username=username, password=password) login(request, user) #current data in profile table for user current_user = request.user data = UserProfile() data.user_id = current_user.id data.image = "images/users/user_image.png" data.save() messages.success(request, "Sitemize başarılı bir şekilde üye oldunuz.") return HttpResponseRedirect('/') form = SignUpForm() context = {'form': form} return render(request, 'sign_up.html', context)