is `content` a queryset? On Thursday, January 19, 2023 at 8:21:39 AM UTC-5 monisha.s...@ideas2it.com wrote:
> @staticmethod > def post(request, *args, **kwargs): > constant = utils.send_grid_key > sg = SendGridAPIClient(constant) > subject = get_subject() > content = get_content() > message = Mail( > from_email=From((utils.sender_mail, 'Hello')), > to_emails=To('man...@gmail.com'), > # to_emails=To(get_email()), > subject=subject, > html_content=content) > response = sg.send(message) > print(response.status_code) > print(response.body) > print(response.headers) > return Response(response) > > > Traceback (most recent call last): > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\core\handlers\exception.py", > > line 55, in inner > response = get_response(request) > ^^^^^^^^^^^^^^^^^^^^^ > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\core\handlers\base.py", > > line 197, in _get_response > response = wrapped_callback(request, *callback_args, **callback_kwargs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\views\decorators\csrf.py", > > line 54, in wrapped_view > return view_func(*args, **kwargs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^ > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\views\generic\base.py", > > line 103, in view > return self.dispatch(request, *args, **kwargs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py", > > line 509, in dispatch > response = self.handle_exception(exc) > ^^^^^^^^^^^^^^^^^^^^^^^^^^ > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py", > > line 469, in handle_exception > self.raise_uncaught_exception(exc) > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py", > > line 480, in raise_uncaught_exception > raise exc > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py", > > line 506, in dispatch > response = handler(request, *args, **kwargs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "C:\Users\Lenovo\marketautomation\automation\user\views.py", line > 140, in post > message = Mail( > ^^^^^ > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\sendgrid\helpers\mail\mail.py", > > line 80, in __init__ > self.add_content(html_content, MimeType.html) > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\sendgrid\helpers\mail\mail.py", > > line 734, in add_content > if content.mime_type == MimeType.text: > ^^^^^^^^^^^^^^^^^ > AttributeError: 'QuerySet' object has no attribute 'mime_type' > [19/Jan/2023 17:54:52] ERROR - Internal Server Error: /automation/user/mail > Traceback (most recent call last): > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\core\handlers\exception.py", > > line 55, in inner > response = get_response(request) > ^^^^^^^^^^^^^^^^^^^^^ > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\core\handlers\base.py", > > line 197, in _get_response > response = wrapped_callback(request, *callback_args, **callback_kwargs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\views\decorators\csrf.py", > > line 54, in wrapped_view > return view_func(*args, **kwargs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^ > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\views\generic\base.py", > > line 103, in view > return self.dispatch(request, *args, **kwargs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py", > > line 509, in dispatch > response = self.handle_exception(exc) > ^^^^^^^^^^^^^^^^^^^^^^^^^^ > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py", > > line 469, in handle_exception > self.raise_uncaught_exception(exc) > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py", > > line 480, in raise_uncaught_exception > raise exc > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py", > > line 506, in dispatch > response = handler(request, *args, **kwargs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "C:\Users\Lenovo\marketautomation\automation\user\views.py", line > 140, in post > message = Mail( > ^^^^^ > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\sendgrid\helpers\mail\mail.py", > > line 80, in __init__ > self.add_content(html_content, MimeType.html) > File > "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\sendgrid\helpers\mail\mail.py", > > line 734, in add_content > if content.mime_type == MimeType.text: > > > i dont know how to fix the error, just help me to fix this > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e1254868-ac2b-4eb5-80d3-cea4a3a94c76n%40googlegroups.com.