diff --git a/README.md b/README.md index c661923..b44bc4c 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,5 @@ http://52.79.152.220:8000/ 2. $ python manage.py makemigrations 3. $ python manage.py migrates ``` -issue관련해서 질문이 있는경우 바로 말씀해주세요! +- css설정 때문에 화면 창을 줄이면 레이아웃이 망가질 수 있습니다ㅠ 창 크기를 최대로 해서 사용해주세요 +- issue관련해서 질문이 있는경우 바로 말씀해주세요! diff --git a/users/models.py b/users/models.py index edfc39a..5a9c909 100644 --- a/users/models.py +++ b/users/models.py @@ -9,7 +9,7 @@ class User(AbstractUser): username = None name = models.CharField(default="name", max_length=64) - email = models.CharField(default="email", max_length=64) + email = models.CharField(default="email", max_length=64, unique=True) password = models.CharField(default="password", max_length=64) birth = models.CharField(default="birth", max_length=8) diff --git a/users/templates/signup.html b/users/templates/signup.html index c166bee..ab93a01 100644 --- a/users/templates/signup.html +++ b/users/templates/signup.html @@ -22,7 +22,9 @@
Leave perfume where you're staying
-
+ + +
@@ -32,7 +34,8 @@
Leave perfume where you're staying
-
+ +
diff --git a/users/views.py b/users/views.py index b7b8806..f86be47 100644 --- a/users/views.py +++ b/users/views.py @@ -1,4 +1,4 @@ -from django.shortcuts import render, redirect +from django.shortcuts import get_object_or_404, render, redirect from django.contrib.auth import authenticate, logout from .models import User , Blog from django.contrib import auth @@ -18,15 +18,19 @@ def signup(request): re_password = request.POST.get('re_password', False) birth = request.POST.get('birth', False) if password != re_password : - return render(request, 'signup.html' , {'error' : 'password incorrect!'}) + return render(request, 'signup.html' , {'pwerror' : 'password incorrect!'}) else: - user = User.objects.create_user(email, password) - user.birth = birth - user.re_password = re_password - user.name = name - user.save() - - return redirect('/') + try: + is_valid = User.objects.get(email=email) + except: + user = User.objects.create_user(email, password) + user.birth = birth + user.re_password = re_password + user.name = name + user.save() + return redirect('/') + + return render(request, 'signup.html', {'emailerror':'중복된 아이디입니다'}) return render(request, 'signup.html')