Skip to content

Commit 63030af

Browse files
committed
clean up
1 parent d4b4cc7 commit 63030af

File tree

3 files changed

+0
-42
lines changed

3 files changed

+0
-42
lines changed

authentication/serializers.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,6 @@ class Meta:
2525
read_only_fields = ['is_staff', 'is_superuser']
2626

2727

28-
class SignUpSerializer(serializers.ModelSerializer):
29-
30-
class Meta:
31-
model = User
32-
fields = ['email', 'first_name', 'last_name', 'password',
33-
'phone', 'mobile', 'birth_date']
34-
extra_kwargs = {'password': {'style': {'input_type': 'password'}}}
35-
36-
def create(self, validated_data):
37-
user = get_user_model()
38-
user.objects.create_user(
39-
email=validated_data['email'],
40-
first_name=validated_data['first_name'],
41-
last_name=validated_data['last_name'],
42-
password=validated_data['password'],
43-
)
44-
45-
4628
class TeamSerializer(serializers.ModelSerializer):
4729
class Meta:
4830
model = Team

authentication/urls.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,4 @@
1212

1313
urlpatterns = [
1414
path('', include(router.urls)),
15-
path('request_signup/', views.UserSignUpView.as_view(),
16-
name='request_signup'),
1715
]

authentication/views.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,6 @@ class TeamViewSet(viewsets.ModelViewSet):
5454
search_fields = ['name']
5555

5656

57-
class UserSignUpView(GenericAPIView):
58-
serializer_class = SignUpSerializer
59-
permission_classes = [permissions.AllowAny, IsNotAuthenticated]
60-
write_only = True
61-
62-
def post(self, request):
63-
serializer = self.serializer_class(data=request.data)
64-
65-
if serializer.is_valid():
66-
try:
67-
user = get_user_model()
68-
validate_password(serializer.data['password'], user)
69-
except ValidationError as error:
70-
return Response(str(error), status=status.HTTP_400_BAD_REQUEST)
71-
72-
serializer.create(serializer.data)
73-
return Response({'Account created': serializer.data['email']},
74-
status=status.HTTP_201_CREATED)
75-
76-
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
77-
78-
7957
def signup(request):
8058
"""The view for the sign-up page."""
8159
# allow only unauthenticated user to visit the signup page

0 commit comments

Comments
 (0)