get_a_room/accounts/views.py
def register(request):
    """
    Endpoint for registration.
    Does not require any permissions, so that anyone can access it.
    """
    USER_FIELDS = ['username', 'password', 'email', 'role']
    serialized = UserSerializer(data=request.data)
    if serialized.is_valid(raise_exception=True):
        user_data = {
            field: data
            for (field, data) in request.data.items()
            if field in USER_FIELDS
        }
        user = User.objects.create_user(
            **user_data
        )

        return Response(
            UserSerializer(instance=user, context={'request': request}).data,
            status=status.HTTP_201_CREATED,
        )

    Endpoint for registration.
    Does not require any permissions, so that anyone can access it.
    
Endpoint for registration.
Does not require any permissions, so that anyone can access it.
Endpoint for registration . Does not require any permissions so that anyone can access it .
def register(request):
    USER_FIELDS = ['username', 'password', 'email', 'role']
    serialized = UserSerializer(data=request.data)
    if serialized.is_valid(raise_exception=True):
        user_data = {
            field: data
            for (field, data) in request.data.items()
            if field in USER_FIELDS
        }
        user = User.objects.create_user(
            **user_data
        )
        return Response(
            UserSerializer(instance=user, context={'request': request}).data,
            status=status.HTTP_201_CREATED,
        )
def register ( request ) : USER_FIELDS = [ 'username' , 'password' , 'email' , 'role' ] serialized = UserSerializer ( data = request . data ) if serialized . is_valid ( raise_exception = True ) : user_data = { field : data for ( field , data ) in request . data . items ( ) if field in USER_FIELDS } user = User . objects . create_user ( ** user_data ) return Response ( UserSerializer ( instance = user , context = { 'request' : request } ) . data , status = status . HTTP_201_CREATED , )
Endpoint for registration.
Endpoint for registration .
"""
    Endpoint for registration.
    Does not require any permissions, so that anyone can access it.
    """
request