fix - deleted user -> trash=True
This commit is contained in:
@@ -174,6 +174,8 @@ class UserViewSet(SoftDeleteMixin, ModelViewSet):
|
||||
else:
|
||||
user_relations.soft_delete()
|
||||
|
||||
user.soft_delete()
|
||||
|
||||
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
|
||||
@@ -113,18 +113,19 @@ class UserSerializer(serializers.ModelSerializer):
|
||||
|
||||
if not self.instance:
|
||||
if self.Meta.model.objects.filter(
|
||||
Q(mobile=mobile) | Q(username=attrs['username'])
|
||||
Q(mobile=mobile) | Q(username=attrs['username']),
|
||||
trash=False
|
||||
).exists():
|
||||
raise UserExistException()
|
||||
|
||||
elif self.instance:
|
||||
if self.instance.mobile != mobile:
|
||||
if self.Meta.model.objects.filter(mobile=mobile).exists():
|
||||
if self.Meta.model.objects.filter(trash=False, mobile=mobile).exists():
|
||||
raise UserExistException()
|
||||
|
||||
if 'username' in attrs.keys():
|
||||
if self.instance.username != attrs['username']:
|
||||
if self.Meta.model.objects.filter(username=attrs['username']).exists():
|
||||
if self.Meta.model.objects.filter(trash=False, username=attrs['username']).exists():
|
||||
raise UserExistException()
|
||||
|
||||
return attrs
|
||||
@@ -272,22 +273,22 @@ class OrganizationSerializer(serializers.ModelSerializer):
|
||||
if not org_type.is_repeatable:
|
||||
if org_type.org_type_field == 'PR' and self.instance.province != attrs[
|
||||
'province'] and self.Meta.model.objects.filter(
|
||||
type=org_type,
|
||||
province=attrs['province'],
|
||||
type=org_type,
|
||||
province=attrs['province'],
|
||||
).exists():
|
||||
raise OrganizationTypeRepeatableException()
|
||||
|
||||
if org_type.org_type_field == 'CI' and self.instance.city != attrs[
|
||||
'city'] and self.Meta.model.objects.filter(
|
||||
type=org_type,
|
||||
city=attrs['city'],
|
||||
type=org_type,
|
||||
city=attrs['city'],
|
||||
).exists():
|
||||
raise OrganizationTypeRepeatableException()
|
||||
|
||||
if org_type.org_type_field == 'CO' and self.instance.province != attrs[
|
||||
'province'] and self.Meta.model.objects.filter(
|
||||
type=org_type,
|
||||
province=attrs['province'],
|
||||
type=org_type,
|
||||
province=attrs['province'],
|
||||
).exists():
|
||||
raise OrganizationTypeRepeatableException()
|
||||
|
||||
|
||||
@@ -580,3 +580,7 @@ AssertionError: .validate() should return the validated data
|
||||
[2025-10-29 10:40:10,133] INFO django.server | IP: - | Path: - | "GET /auth/api/v1/organization-type/?org_type_field=PR HTTP/1.1" 200 400
|
||||
[2025-10-29 10:40:16,966] INFO django.server | IP: - | Path: - | "GET /auth/api/v1/organization-type/?org_type_field=CO HTTP/1.1" 200 276
|
||||
[2025-10-29 16:36:54,591] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py changed, reloading.
|
||||
[2025-10-29 16:36:58,756] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
|
||||
[2025-10-29 16:57:50,609] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py changed, reloading.
|
||||
[2025-10-29 16:57:52,543] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
|
||||
[2025-10-29 16:57:57,860] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py changed, reloading.
|
||||
|
||||
Reference in New Issue
Block a user