#djoser + rest. Auth. Unable to create account.
58 messages · Page 1 of 1 (latest)
That is cusom manager
Custom user model
View
urls
So
i do this request to my server to create a user, like i ve seen an example in official docs
And receive Unable to create account
I dont know where is the problem
I ve added djoser to INSTALLED APS
Firstly please look at #readme-1st about sharing code snippets.
Secondly a link to djoser would help if that is the documentation you are referring to.
Finally based on the last script you shared I don't believe most of the code is used. What is the JSON response from your script?
Is there an error from your server?
Error BAD REQUEST
I receive only this
A bad request means that the request is incorrect in some way
It could be any number of issues.
(((
It's also worth noting that you are not calling the userviewset you have defined. But something within djoser
Could you write in full sentences please
Even if i make requests by form
I receive the same error
These are the logs
from rest_framework import viewsets, permissions
from django.contrib.auth import get_user_model
from RestServer.models import Transaction
from RestServer.serializers import UserSerializer, TransactionSerializer
Users = get_user_model()
class UserViewSet(viewsets.ModelViewSet):
queryset = Users.objects.all()
serializer_class = UserSerializer
permission_classes = [permissions.IsAuthenticated]
class TransactionViewSet(viewsets.ModelViewSet):
queryset = Transaction.objects.all()
serializer_class = TransactionSerializer
permission_classes = [permissions.IsAuthenticated]
Are views right?
You are not using those views fro what I can tell of your urls.py.
/auth/users is within djoser.urls so you would need to follow their docs.
Your Userviewset is just /users from what I can tell
ah okey
from django.urls import path, include
from RestServer.views import *
from rest_framework import routers
router = routers.SimpleRouter()
router.register('auth/groups/', TransactionViewSet)
router.register('auth/users/', UserViewSet)
urlpatterns = [
path('', include(router.urls)),
# path('test/', UserView.as_view()),
path('auth/', include('djoser.urls')),
]```
It doesnt work that way
okey
so what request should i send
In docs they use curl
I also used it but i get some other errors, and even though why shouldnt i be able to make the same thing using my code
He writes that: "password" is not a command
and that email and password are required though i ve passed them like in docs
Her
zr
curl -X POST http://127.0.0.1:8000/auth/users/ --data 'email=tabalex7777@gmail.com&password=alpine12'
I make that
Are using djoser or not?
Ye
Here
djoser.urls
Then why have you replaced it with
router.register('auth/users/', UserViewSet)
You seem to be misunderstanding what URLs you have configured
So how does request look like? @ebon ruin
I don't know since I haven't every used djoser myself
(((