diff --git a/.idea/Rasaddam_Backend.iml b/.idea/Rasaddam_Backend.iml index c5d6090..168bde0 100644 --- a/.idea/Rasaddam_Backend.iml +++ b/.idea/Rasaddam_Backend.iml @@ -14,7 +14,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index 29f5506..296aa57 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/apps/authentication/api/v1/serializers/serializer.py b/apps/authentication/api/v1/serializers/serializer.py index 7afb5e6..37ae26e 100644 --- a/apps/authentication/api/v1/serializers/serializer.py +++ b/apps/authentication/api/v1/serializers/serializer.py @@ -133,7 +133,8 @@ class UserSerializer(serializers.ModelSerializer): def update(self, instance, validated_data): """ update user instance """ instance.username = validated_data.get('username', instance.username) - instance.password = validated_data.get('password', instance.password) + if not validated_data.get('password'): + instance.password = validated_data.get('password', instance.password) instance.first_name = validated_data.get('first_name') instance.last_name = validated_data.get('last_name') instance.is_active = validated_data.get('is_active') diff --git a/apps/product/web/api/v1/viewsets/quota_api.py b/apps/product/web/api/v1/viewsets/quota_api.py index 054a6f8..a3dbda8 100644 --- a/apps/product/web/api/v1/viewsets/quota_api.py +++ b/apps/product/web/api/v1/viewsets/quota_api.py @@ -55,7 +55,10 @@ class QuotaViewSet(viewsets.ModelViewSet, DynamicSearchMixin): # noqa user_relation = request.user.user_relation.all().first() # add user relation to data - request.data['registerer_organization'] = user_relation.organization.id + if user_relation.organization: + request.data['registerer_organization'] = user_relation.organization.id + else: + raise APIException("برای این کاربر سازمانی تعریف نشده است") # noqa # create quota serializer = self.serializer_class(data=request.data)