fix bug of validate org

This commit is contained in:
2025-10-29 09:51:55 +03:30
parent 677e80183d
commit 5b42e6a076
2 changed files with 132 additions and 2 deletions

View File

@@ -330,3 +330,134 @@ django.core.exceptions.FieldError: Unsupported lookup 'name' for ForeignKey or j
[2025-10-28 16:04:07,708] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
[2025-10-28 16:46:52,938] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py changed, reloading.
[2025-10-28 16:46:57,388] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
[2025-10-29 09:48:14,284] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
[2025-10-29 09:48:24,422] INFO django.server | IP: - | Path: - | "POST /captcha/ HTTP/1.1" 200 730
[2025-10-29 09:49:05,642] INFO django.server | IP: - | Path: - | "POST /auth/api/v1/login/ HTTP/1.1" 200 681
[2025-10-29 09:49:31,512] WARNING django.request | IP: 127.0.0.1 | Path: /auth/api/v1/organization/ | Not Acceptable: /auth/api/v1/organization/
[2025-10-29 09:49:31,513] WARNING django.server | IP: - | Path: - | "POST /auth/api/v1/organization/ HTTP/1.1" 406 70
[2025-10-29 09:49:45,399] ERROR django.request | IP: 127.0.0.1 | Path: /auth/api/v1/organization/ | Internal Server Error: /auth/api/v1/organization/
Traceback (most recent call last):
File "D:\Software\env\Lib\site-packages\django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\django\views\decorators\csrf.py", line 65, in _view_wrapper
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\viewsets.py", line 125, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\views.py", line 515, in dispatch
response = self.handle_exception(exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\views.py", line 472, in handle_exception
response = exception_handler(exc, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\views.py", line 512, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\python-3.12.0\Lib\contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "D:\Project\Rasaddam_Backend\apps\authentication\api\v1\api.py", line 265, in create
if serializer.is_valid():
^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\serializers.py", line 225, in is_valid
self._validated_data = self.run_validation(self.initial_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\serializers.py", line 447, in run_validation
value = self.validate(value)
^^^^^^^^^^^^^^^^^^^^
File "D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py", line 235, in validate
national_unique_id = (data.get('organization'))['national_unique_id']
^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
[2025-10-29 09:49:45,446] ERROR django.server | IP: - | Path: - | "POST /auth/api/v1/organization/ HTTP/1.1" 500 130407
[2025-10-29 09:50:27,616] ERROR django.request | IP: 127.0.0.1 | Path: /auth/api/v1/organization/ | Internal Server Error: /auth/api/v1/organization/
Traceback (most recent call last):
File "D:\Software\env\Lib\site-packages\django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\django\views\decorators\csrf.py", line 65, in _view_wrapper
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\viewsets.py", line 125, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\views.py", line 515, in dispatch
response = self.handle_exception(exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\views.py", line 472, in handle_exception
response = exception_handler(exc, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\views.py", line 512, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\python-3.12.0\Lib\contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "D:\Project\Rasaddam_Backend\apps\authentication\api\v1\api.py", line 265, in create
if serializer.is_valid():
^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\serializers.py", line 225, in is_valid
self._validated_data = self.run_validation(self.initial_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\serializers.py", line 447, in run_validation
value = self.validate(value)
^^^^^^^^^^^^^^^^^^^^
File "D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py", line 235, in validate
national_unique_id = (data.get('organization'))['national_unique_id']
^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
[2025-10-29 09:50:27,672] ERROR django.server | IP: - | Path: - | "POST /auth/api/v1/organization/ HTTP/1.1" 500 130802
[2025-10-29 09:50:48,041] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py changed, reloading.
[2025-10-29 09:50:50,059] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
[2025-10-29 09:50:55,995] ERROR django.request | IP: 127.0.0.1 | Path: /auth/api/v1/organization/ | Internal Server Error: /auth/api/v1/organization/
Traceback (most recent call last):
File "D:\Software\env\Lib\site-packages\django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\django\views\decorators\csrf.py", line 65, in _view_wrapper
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\viewsets.py", line 125, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\views.py", line 515, in dispatch
response = self.handle_exception(exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\views.py", line 472, in handle_exception
response = exception_handler(exc, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\views.py", line 512, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\python-3.12.0\Lib\contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "D:\Project\Rasaddam_Backend\apps\authentication\api\v1\api.py", line 265, in create
if serializer.is_valid():
^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\serializers.py", line 225, in is_valid
self._validated_data = self.run_validation(self.initial_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Software\env\Lib\site-packages\rest_framework\serializers.py", line 447, in run_validation
value = self.validate(value)
^^^^^^^^^^^^^^^^^^^^
File "D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py", line 235, in validate
national_unique_id = data.get('national_unique_id')
^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
[2025-10-29 09:50:56,057] ERROR django.server | IP: - | Path: - | "POST /auth/api/v1/organization/ HTTP/1.1" 500 130744
[2025-10-29 09:51:29,946] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py changed, reloading.
[2025-10-29 09:51:33,813] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
[2025-10-29 09:51:47,218] WARNING django.request | IP: 127.0.0.1 | Path: /auth/api/v1/organization/ | Forbidden: /auth/api/v1/organization/
[2025-10-29 09:51:47,219] WARNING django.server | IP: - | Path: - | "POST /auth/api/v1/organization/ HTTP/1.1" 403 86