On 30/05/2021 3:45 pm, Bhathiya Amarasinghe wrote:
>
>
> [30/May/2021 11:01:46] "POST /api/addtocart/ HTTP/1.1" 500 214965
> Internal Server Error: /api/addtocart/
> Traceback (most recent call last):
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\djongo\sql2mongo\query.py", line 856,
> in parse
> return handler(self, statement)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\djongo\sql2mongo\query.py", line 932,
> in _select
> return SelectQuery(self.db, self.connection_properties, sm,
> self._params)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\djongo\sql2mongo\query.py", line 116,
> in __init__
> super().__init__(*args)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\djongo\sql2mongo\query.py", line 62, in
> __init__
> self.parse()
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\djongo\sql2mongo\query.py", line 152,
> in parse
> self.where = WhereConverter(self, statement)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\djongo\sql2mongo\converters.py", line
> 27, in __init__
> self.parse()
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\djongo\sql2mongo\converters.py", line
> 119, in parse
> self.op = WhereOp(
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\djongo\sql2mongo\operators.py", line
> 476, in __init__
> self.evaluate()
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\djongo\sql2mongo\operators.py", line
> 465, in evaluate
> op.evaluate()
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\djongo\sql2mongo\operators.py", line
> 465, in evaluate
> op.evaluate()
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\djongo\sql2mongo\operators.py", line
> 258, in evaluate
> self.rhs.negate()
> AttributeError: 'NoneType' object has no attribute 'negate'
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
> File "D:\Bhathiya Admin\Python\lib\site-packages\djongo\cursor.py",
> line 51, in execute
> self.result = Query(
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\djongo\sql2mongo\query.py", line 783,
> in __init__
> self._query = self.parse()
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\djongo\sql2mongo\query.py", line 884,
> in parse
> raise exe from e
> djongo.exceptions.SQLDecodeError:
>
> Keyword: None
> Sub SQL: None
> FAILED SQL: SELECT "shop_cart"."id",
> "shop_cart"."customer_id", "shop_cart"."total", "shop_cart"."complit",
> "shop_cart"."date" FROM "shop_cart" WHERE ("shop_cart"."customer_id" =
> %(0)s AND NOT "shop_cart"."complit") ORDER BY "shop_cart"."id" ASC LIMIT 1
> Params: (13,)
> Version: 1.3.4
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\db\backends\utils.py", line 84,
> in _execute
> return self.cursor.execute(sql, params)
> File "D:\Bhathiya Admin\Python\lib\site-packages\djongo\cursor.py",
> line 59, in execute
> raise db_exe from e
> djongo.database.DatabaseError
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\core\handlers\exception.py",
> line 47, in inner
> response = get_response(request)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\core\handlers\base.py", line
> 181, in _get_response
> response = wrapped_callback(request, *callback_args,
> **callback_kwargs)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\views\decorators\csrf.py", line
> 54, in wrapped_view
> return view_func(*args, **kwargs)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\views\generic\base.py", line 70,
> in view
> return self.dispatch(request, *args, **kwargs)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\rest_framework\views.py", line 509, in
> dispatch
> response = self.handle_exception(exc)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\rest_framework\views.py", line 469, in
> handle_exception
> self.raise_uncaught_exception(exc)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\rest_framework\views.py", line 480, in
> raise_uncaught_exception
> raise exc
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\rest_framework\views.py", line 506, in
> dispatch
> response = handler(request, *args, **kwargs)
> File "D:\Final Version\shop\views.py", line 248, in post
> cart_cart = Cart.objects.filter(
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\db\models\query.py", line 674,
> in first
> for obj in (self if self.ordered else self.order_by('pk'))[:1]:
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\db\models\query.py", line 280,
> in __iter__
> self._fetch_all()
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\db\models\query.py", line 1324,
> in _fetch_all
> self._result_cache = list(self._iterable_class(self))
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\db\models\query.py", line 51, in
> __iter__
> results = compiler.execute_sql(chunked_fetch=self.chunked_fetch,
> chunk_size=self.chunk_size)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\db\models\sql\compiler.py", line
> 1175, in execute_sql
> cursor.execute(sql, params)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\db\backends\utils.py", line 98,
> in execute
> return super().execute(sql, params)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\db\backends\utils.py", line 66,
> in execute
> return self._execute_with_wrappers(sql, params, many=False,
> executor=self._execute)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\db\backends\utils.py", line 75,
> in _execute_with_wrappers
> return executor(sql, params, many, context)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\db\backends\utils.py", line 84,
> in _execute
> return self.cursor.execute(sql, params)
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\db\utils.py", line 90, in __exit__
> raise dj_exc_value.with_traceback(traceback) from exc_value
> File "D:\Bhathiya
> Admin\Python\lib\site-packages\django\db\backends\utils.py", line 84,
> in _execute
> return self.cursor.execute(sql, params)
> File "D:\Bhathiya Admin\Python\lib\site-packages\djongo\cursor.py",
> line 59, in execute
> raise db_exe from e
> django.db.utils.DatabaseError
I have never used MongoDb and I suspect makemigrations and migrate
probably don't apply. But if it was PostgreSQL I would suggest you
makemigrations and migrate and try again.
However ...
AttributeError: 'NoneType' object has no attribute 'negate'
... I would be looking at all my objects with a 'negate' attribute to
see if I could spot where the system is getting the None object instead
of what is expected. It may or may not be the shop_cart you see in the
next part of the error reported.
Good luck
Mike
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Bhathiya Admin\Python\lib\site-packages\djongo\cursor.py",
line 51, in execute
self.result = Query(
File "D:\Bhathiya
Admin\Python\lib\site-packages\djongo\sql2mongo\query.py", line 783, in
__init__
self._query = self.parse()
File "D:\Bhathiya
Admin\Python\lib\site-packages\djongo\sql2mongo\query.py", line 884, in
parse
raise exe from e
djongo.exceptions.SQLDecodeError:
Keyword: None
Sub SQL: None
FAILED SQL: SELECT "shop_cart"."id", "shop_cart"."customer_id",
"shop_cart"."total", "shop_cart"."complit", "shop_cart"."date" FROM
"shop_cart" WHERE ("shop_cart"."customer_id" = %(0)s AND NOT
"shop_cart"."complit") ORDER BY "shop_cart"."id" ASC LIMIT 1
Params: (13,)
Version: 1.3.4
> --
> 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+unsubscribe@googlegroups.com
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5f3cc5a4-0dac-4f3c-9493-be0fe32d74c9n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/5f3cc5a4-0dac-4f3c-9493-be0fe32d74c9n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.
--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fb7a6687-9747-e380-331b-3f95b0621213%40dewhirst.com.au.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment