From 2d67f10e8122608417f36c8031d5986568022913 Mon Sep 17 00:00:00 2001 From: Adnan Kattekaden Date: Fri, 24 Nov 2023 22:20:36 +0530 Subject: [PATCH] register issue fix --- api/register/register_views.py | 4 +--- api/register/serializers.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/api/register/register_views.py b/api/register/register_views.py index 82f53e4f..f3f40c87 100644 --- a/api/register/register_views.py +++ b/api/register/register_views.py @@ -1,7 +1,4 @@ -import decouple -import requests from django.db.models import Q - from rest_framework.views import APIView from db.organization import Country, Department, District, Organization, State, Zone @@ -95,6 +92,7 @@ def post(self, request): class RegisterDataAPI(APIView): + def post(self, request): data = request.data data = {key: value for key, value in data.items() if value} diff --git a/api/register/serializers.py b/api/register/serializers.py index 75088b8e..b4fa59a0 100644 --- a/api/register/serializers.py +++ b/api/register/serializers.py @@ -232,7 +232,7 @@ def create(self, validated_data): role = validated_data.pop("role", None) validated_data["muid"] = register_helper.generate_muid( - validated_data["first_name"], validated_data["last_name"] + validated_data["first_name"], validated_data.get('last_name', '') ) password = validated_data.pop("password") hashed_password = make_password(password)