From 9546d99d663a7ef9118a51c847efd5cba325ac7d Mon Sep 17 00:00:00 2001 From: clonbg Date: Tue, 21 Feb 2023 16:06:40 +0100 Subject: [PATCH] ya se pueden registrar, faltaba username --- authentication/models.py | 2 +- listaCompra/settings.py | 3 ++- listaCompra/urls.py | 1 + requirements.txt | 25 +++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/authentication/models.py b/authentication/models.py index b2ee065..e389ad8 100644 --- a/authentication/models.py +++ b/authentication/models.py @@ -9,7 +9,7 @@ class CustomUserManager(BaseUserManager): if not email: raise ValueError(_("El email es necesario")) email = self.normalize_email(email) - new_user = self.model(email=email, **extra_fields) + new_user = self.model(username=email, email=email, **extra_fields) new_user.set_password(password) new_user.save() return new_user diff --git a/listaCompra/settings.py b/listaCompra/settings.py index b02a06a..3427772 100644 --- a/listaCompra/settings.py +++ b/listaCompra/settings.py @@ -30,7 +30,8 @@ INSTALLED_APPS = [ 'item.apps.ItemConfig', 'compra.apps.CompraConfig', # Terceras partes - 'rest_framework' + 'rest_framework', + 'djoser' ] AUTH_USER_MODEL = 'authentication.User' diff --git a/listaCompra/urls.py b/listaCompra/urls.py index b0a224a..4696cf2 100644 --- a/listaCompra/urls.py +++ b/listaCompra/urls.py @@ -8,4 +8,5 @@ urlpatterns = [ path('compra/', include('compra.urls')), path('item/', include('item.urls')), path('lista/', include('lista.urls')), + path('token/', include('djoser.urls')), ] diff --git a/requirements.txt b/requirements.txt index 2f0233d..e53eb19 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,31 @@ asgiref==3.6.0 +certifi==2022.12.7 +cffi==1.15.1 +charset-normalizer==3.0.1 +coreapi==2.3.3 +coreschema==0.0.4 +cryptography==39.0.1 +defusedxml==0.7.1 Django==4.1.7 +django-templated-mail==1.1.1 djangorestframework==3.14.0 +djangorestframework-simplejwt==4.8.0 +djoser==2.1.0 +idna==3.4 +itypes==1.2.0 +Jinja2==3.1.2 +MarkupSafe==2.1.2 +oauthlib==3.2.2 +pycparser==2.21 +PyJWT==2.6.0 python-decouple==3.7 +python3-openid==3.2.0 pytz==2022.7.1 +requests==2.28.2 +requests-oauthlib==1.3.1 +six==1.16.0 +social-auth-app-django==4.0.0 +social-auth-core==4.3.0 sqlparse==0.4.3 +uritemplate==4.1.1 +urllib3==1.26.14