Skip to content

Commit

Permalink
♻️Refact : 코드 리팩토링
Browse files Browse the repository at this point in the history
 - 이전 회원가입, 로그인 api에 필요한 파일들과 약간의 코드 수정 (중요 x)
  • Loading branch information
airhac committed Oct 28, 2023
1 parent 0244a36 commit 350a3a4
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion accounts/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def create_user(self,username, email, password, **extra_fields):
return user

@classmethod
def create_auth_code(self):
def create_auth_code(cls):
auth_code = ""
for _ in range(6):
auth_code += random.choice(STRING_SEQUENCE)
Expand Down
4 changes: 2 additions & 2 deletions accounts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.6 on 2023-10-27 17:52
# Generated by Django 4.2.6 on 2023-10-28 23:57

from django.db import migrations, models
import django.utils.timezone
Expand Down Expand Up @@ -28,7 +28,7 @@ class Migration(migrations.Migration):
('email', models.EmailField(max_length=254, verbose_name='email address')),
('username', models.CharField(max_length=30, unique=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('auth_code', models.CharField(blank=True, max_length=6, null=True)),
('auth_code', models.CharField(blank=True, max_length=7, null=True)),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')),
],
Expand Down
2 changes: 1 addition & 1 deletion accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class User(AbstractUser):
email = models.EmailField(verbose_name='email address')
username = models.CharField(max_length=30, unique=True)
updated_at = models.DateTimeField(auto_now=True)
auth_code = models.CharField(max_length=6, null=True, blank=True)
auth_code = models.CharField(max_length=7, null=True, blank=True)


##user model에서 각 row를 식별해줄 key를 설정
Expand Down
4 changes: 2 additions & 2 deletions accounts/serializers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.contrib.auth import get_user_model
from .models import User
from dj_rest_auth.registration.serializers import RegisterSerializer
from rest_framework import serializers
from dj_rest_auth.serializers import LoginSerializer
Expand All @@ -8,7 +8,7 @@

class CustomRegisterSerializer(RegisterSerializer):
class Meta:
model = get_user_model()
model = User
fields = [
"username",
"email",
Expand Down
22 changes: 22 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
asgiref==3.7.2
certifi==2023.7.22
cffi==1.16.0
charset-normalizer==3.3.1
cryptography==41.0.5
defusedxml==0.7.1
dj-rest-auth==5.0.1
Django==4.2.6
django-allauth==0.57.0
django-cors-headers==4.3.0
django-environ==0.11.2
djangorestframework==3.14.0
djangorestframework-simplejwt==5.3.0
drf-yasg==1.21.7
idna==3.4
inflection==0.5.1
mysqlclient==2.2.0
oauthlib==3.2.2
packaging==23.2
pycparser==2.21
PyJWT==2.8.0
PyMySQL==1.1.0
python3-openid==3.2.0
pytz==2023.3.post1
PyYAML==6.0.1
requests==2.31.0
requests-oauthlib==1.3.1
sqlparse==0.4.4
tzdata==2023.3
uritemplate==4.1.1
urllib3==2.0.7
File renamed without changes.

0 comments on commit 350a3a4

Please sign in to comment.