I have wriiten some code here. Please check out the file. When I filled all the fields from django admin then it's working but when I redirect it with http://127.0.0.1:8000/user/application then I am getting below error
return [
TypeError: 'User' object is not iterable
Traceback
Traceback (most recent call last):
File "C:\Python\Python38\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Python\Python38\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Python\Python38\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Python\Python38\lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "C:\Python\Python38\lib\site-packages\django\views\generic\base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Users\Public\AppData\Roaming\Python\Python38\site-packages\rest_framework\views.py", line 505, in dispatch
response = self.handle_exception(exc)
File "C:\Users\Public\AppData\Roaming\Python\Python38\site-packages\rest_framework\views.py", line 465, in handle_exception
self.raise_uncaught_exception(exc)
File "C:\Users\Public\AppData\Roaming\Python\Python38\site-packages\rest_framework\views.py", line 476, in raise_uncaught_exception
raise exc
File "C:\Users\Public\AppData\Roaming\Python\Python38\site-packages\rest_framework\views.py", line 502, in dispatch
response = handler(request, *args, **kwargs)
File "C:\Users\Public\AppData\Roaming\Python\Python38\site-packages\rest_framework\generics.py", line 239, in get
return self.list(request, *args, **kwargs)
File "E:\Project\twitapp\twitapp-core\user\views.py", line 142, in list
return self.get_paginated_response(serializer.data)
File "C:\Users\Public\AppData\Roaming\Python\Python38\site-packages\rest_framework\serializers.py", line 757, in data
ret = super().data
File "C:\Users\Public\AppData\Roaming\Python\Python38\site-packages\rest_framework\serializers.py", line 261, in data
self._data = self.to_representation(self.instance)
File "C:\Users\Public\AppData\Roaming\Python\Python38\site-packages\rest_framework\serializers.py", line 674, in to_representation
return [
File "C:\Users\Public\AppData\Roaming\Python\Python38\site-packages\rest_framework\serializers.py", line 675, in <listcomp>
self.child.to_representation(item) for item in iterable
File "E:\Project\twitapp\twitapp-core\user\serializers.py", line 274, in to_representation
data = super(ApplicationFormSerializer, self).to_representation(instance)
File "C:\Users\Public\AppData\Roaming\Python\Python38\site-packages\rest_framework\serializers.py", line 526, in to_representation
ret[field.field_name] = field.to_representation(attribute)
File "C:\Users\Public\AppData\Roaming\Python\Python38\site-packages\rest_framework\serializers.py", line 674, in to_representation
return [
TypeError: 'User' object is not iterable
2021-04-25 11:32:10,608 django.server ERROR "GET /user/application/ HTTP/1.1" 500 27
Where I did wrong? How can I solve it? What is the mean of this?