From ca2d50e26bd859a72cbe8f32bffacc8506062f68 Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Thu, 29 Feb 2024 00:06:45 +0100 Subject: [PATCH] Some prototyping the registration --- api_v1/auth/__init__.py | 0 api_v1/auth/registration_view.py | 8 ++++---- api_v1/urls.py | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) create mode 100644 api_v1/auth/__init__.py diff --git a/api_v1/auth/__init__.py b/api_v1/auth/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/api_v1/auth/registration_view.py b/api_v1/auth/registration_view.py index 22a6653..d5fabea 100644 --- a/api_v1/auth/registration_view.py +++ b/api_v1/auth/registration_view.py @@ -1,7 +1,7 @@ from django.views import View from django.contrib.auth.models import User from django.http import HttpResponse -from api_v1.user.user_services import acreate_user_information +from api_v1.profile.profile_services import acreate_profile class RegistrationView(View): @@ -12,14 +12,14 @@ class RegistrationView(View): email = request.POST.get('email') display_name = request.POST.get('display_name') - # Check if user already exists + # Check if profile already exists if User.objects.filter(username=username).exists(): return HttpResponse(status=400, content="User already exists") - # Create user + # Create profile user = await User.objects.acreate_user(username, email, password) # Create UserInformation - await acreate_user_information(user, display_name=display_name) + await acreate_profile(user, display_name=display_name) return HttpResponse(status=201, content="User created") diff --git a/api_v1/urls.py b/api_v1/urls.py index 97b223c..5c9bf05 100644 --- a/api_v1/urls.py +++ b/api_v1/urls.py @@ -1,8 +1,5 @@ from django.urls import path, include -from .auth.registration_view import RegistrationView # Assign register url urlpatterns = [ - path("auth/", include("django.contrib.auth.urls")), - path('auth/register/', RegistrationView.as_view(), name='register'), ]