fix edit password - organization fix childs

This commit is contained in:
2025-08-07 09:45:02 +03:30
parent 6477a35200
commit 482ae540fd
4 changed files with 8 additions and 4 deletions

View File

@@ -14,7 +14,7 @@
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.10 (bazrasienv)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.10 (env)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">

2
.idea/misc.xml generated
View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (bazrasienv)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (env)" project-jdk-type="Python SDK" />
</project>

View File

@@ -133,6 +133,7 @@ class UserSerializer(serializers.ModelSerializer):
def update(self, instance, validated_data):
""" update user instance """
instance.username = validated_data.get('username', instance.username)
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')

View File

@@ -55,7 +55,10 @@ class QuotaViewSet(viewsets.ModelViewSet, DynamicSearchMixin): # noqa
user_relation = request.user.user_relation.all().first()
# add user relation to data
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)