Open adityanandanx opened 2 months ago
I would like to work on this issue. Kindly assign this to me.
I am currently facing issue while making the migrations after adding a dummy model, it is because of the conflicting the name of the app which is auth
with the default django package which is django.contrib.auth
under the INSTALLED_APPS
in the settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
.....
"auth"
]
The solution was to change the name of the app from auth
to authentication
. I hope this modification in the application name is fine.
@adityanandanx
yeah it's fine @SharonIV0x86
I currently have this User model created with the following fields and the serializer. I am requesting some reviews on it.
class User(models.Model):
age = models.IntegerField()
firstName = models.CharField(max_length=30)
lastName = models.CharField(max_length=30)
email = models.CharField(max_length=40, unique=True)
password = models.CharField(max_length=40)
role = models.CharField(max_length=12)
And the UserSerializer
that serializes all the fields. I have mixed opinions on serializing all the fields and return them in the response.
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = "__all__" #serializing all fields
#fields = ['password', 'email'] #serializing some fields
Suggest any addition or changes to them. @adityanandanx
You don't have to create a new User model. Django already handles those internally. See this @SharonIV0x86
Requirements
Create a new django app (not project, see this) called
auth
which has these endpoints -/auth/register
- User can create an accountemail, password, confirm_password, full_name
status, message, access_token, refresh_token
/auth/login
- User can login to their accountemail, password
status, message, access_token, refresh_token
/auth/logout
- User can logout of their accountnothing
Authorization: Bearer <access_token>
status, message
/auth/refresh
- User can refresh theiraccess_token
refresh_token
status, message, access_token
Resources