Closed Wladislav closed 1 year ago
can i contribute for this?
This seems to be a cartridge related bug. So please reopen it in cartridge issues or correct me if I'm wrong.
can i contribute for this?
Sure contributions are always welcome. If the changes are in Cartridge please switch to there.
Is there an existing issue for this?
Current Behavior
I just installed the Mezzanine + cartridge to see its capabilities and got an error.
Expected Behavior
pages should be shown
Steps To Reproduce
Django version 4.1, using settings 'codesite.settings' Starting development server at http://*.*.*.*:8000/
Django Version: 4.1 Python Version: 3.8.10 Installed Applications: ('mezzanine.boot', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.redirects', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.sitemaps', 'django.contrib.messages', 'mezzanine.conf', 'mezzanine.core', 'mezzanine.generic', 'mezzanine.pages', 'cartridge.shop', 'mezzanine.blog', 'mezzanine.forms', 'mezzanine.galleries', 'filebrowser_safe', 'grappelli_safe', 'django.contrib.admin', 'django.contrib.staticfiles', 'django_comments') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'cartridge.shop.middleware.ShopMiddleware', 'mezzanine.core.request.CurrentRequestMiddleware', 'mezzanine.core.middleware.RedirectFallbackMiddleware', 'mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware', 'mezzanine.core.middleware.SitePermissionMiddleware', 'mezzanine.pages.middleware.PageMiddleware')
Template error: In template /home/vlad/anycoderu/cartridge/cartridge/shop/templates/shop/includes/user_panel.html, error at line 5 'Cart' instance needs to have a primary key value before this relationship can be used. 1 : {% load i18n shop_tags mezzanine_tags %} 2 : {% spaceless %} 3 : <a href="{% url "shop_cart" %}"> 4 : 5 : {% blocktrans count request.cart.total_quantity as cart_quantity %} 1 item{% plural %}{{ cart_quantity }} items{% endblocktrans %} 6 : {% trans "in cart" %}: 7 : {{ request.cart.total_price|currency }}
8 : {% if request.cart.total_quantity != 0 %} 9 : <a href="{% url "shop_checkout" %}" class="btn btn-primary"> 10 : {% if request.session.order.step %}{% trans "Return to Checkout" %}{% else %}{% trans "Go to Checkout" %}{% endif %} 11 :
12 : {% endif %} 13 : {% if settings.SHOP_USE_WISHLIST %} 14 : <a href="{% url "shop_wishlist" %}" class="btn-wishlist"> 15 :
Traceback (most recent call last): File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/core/handlers/base.py", line 220, in _get_response response = response.render() File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/response.py", line 114, in render self.content = self.rendered_content File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/response.py", line 92, in rendered_content return template.render(context, self._request) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/backends/django.py", line 62, in render return self.template.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 175, in render return self._render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 167, in _render return self.nodelist.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 1005, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 1005, in return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 966, in render_annotated return self.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/loader_tags.py", line 157, in render return compiled_parent._render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 167, in _render return self.nodelist.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 1005, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 1005, in return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 966, in render_annotated return self.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/mezzanine/template/init.py", line 95, in render args = (self.nodelist.render(context), context, token) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 1005, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 1005, in return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 966, in render_annotated return self.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/loader_tags.py", line 208, in render return template.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 177, in render return self._render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 167, in _render return self.nodelist.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 1005, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 1005, in return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 966, in render_annotated return self.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/defaulttags.py", line 322, in render return nodelist.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 1005, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 1005, in return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 966, in render_annotated return self.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/loader_tags.py", line 208, in render return template.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 177, in render return self._render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 167, in _render return self.nodelist.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 1005, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 1005, in return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 966, in render_annotated return self.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/defaulttags.py", line 415, in render return strip_spaces_between_tags(self.nodelist.render(context).strip()) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 1005, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 1005, in return SafeString("".join([node.render_annotated(context) for node in self])) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 966, in render_annotated return self.render(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/templatetags/i18n.py", line 160, in render count = self.counter.resolve(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 715, in resolve obj = self.var.resolve(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 847, in resolve value = self._resolve_lookup(context) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/template/base.py", line 914, in _resolve_lookup current = current() File "/home/vlad/anycoderu/cartridge/cartridge/shop/models.py", line 643, in total_quantity return sum(item.quantity for item in self) File "/home/vlad/anycoderu/cartridge/cartridge/shop/models.py", line 610, in iter self._cached_items = self.items.all() File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/db/models/fields/related_descriptors.py", line 596, in get instance_cache[key] = self.related_manager_cls(instance) File "/home/vlad/anycoderu/anycodenv/lib/python3.8/site-packages/Django-4.1-py3.8.egg/django/db/models/fields/related_descriptors.py", line 634, in init raise ValueError(
Exception Type: ValueError at / Exception Value: 'Cart' instance needs to have a primary key value before this relationship can be used.
Environment
Anything else?
No response