fix user edit bug with address

This commit is contained in:
2025-10-27 14:46:48 +03:30
parent 5d6529cb36
commit 14d30956b9
2 changed files with 6 additions and 3 deletions

View File

@@ -121,7 +121,7 @@ class UserSerializer(serializers.ModelSerializer):
if self.instance.national_code != national_code:
if self.Meta.model.objects.filter(national_code=national_code).exists():
raise UserExistException()
return attrs
def to_representation(self, instance):
@@ -158,8 +158,8 @@ class UserSerializer(serializers.ModelSerializer):
instance.nationality = validated_data.get('nationality')
instance.ownership = validated_data.get('ownership')
instance.address = validated_data.get('address')
instance.address = validated_data.get('unit_name')
instance.address = validated_data.get('unit_national_id')
instance.unit_name = validated_data.get('unit_name')
instance.unit_national_id = validated_data.get('unit_national_id')
instance.photo = validated_data.get('photo')
instance.province = validated_data.get('province', instance.province)
instance.city = validated_data.get('city', instance.city)

View File

@@ -19,3 +19,6 @@
[2025-10-27 14:18:07,772] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\Rasaddam_Backend\request_formatter.py changed, reloading.
[2025-10-27 14:18:11,698] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
[2025-10-27 14:42:16,070] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\mixins\region_filter.py changed, reloading.
[2025-10-27 14:42:18,042] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
[2025-10-27 14:46:25,256] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py changed, reloading.
[2025-10-27 14:46:27,085] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader