Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library object has no attribute 'assignment_tag' #35

Open
djangojeng-e opened this issue Oct 30, 2020 · 0 comments
Open

Library object has no attribute 'assignment_tag' #35

djangojeng-e opened this issue Oct 30, 2020 · 0 comments

Comments

@djangojeng-e
Copy link

djangojeng-e commented Oct 30, 2020

Hi,
I have tested the package with Django 3.1.2 and Django 2.1.1.
Each time I tried, I get to see the error that library object has no attribute 'assignment_tag'.

It was mentioned that this error raises if the package is used with Django below 1.9 but it seems like it is not the case as the same error occurs with Django 2+ and 3+.

Handling this error involved modifying carton_tags.py as below but this is not permanent solution for the package. (comment out assignment_tag and register simple_tag as below)

Would there be any other way to use this package without having to see this assignment_tag error?

`
def get_cart(context, session_key=None, cart_class=Cart):
"""
Make the cart object available in template.

Sample usage::

    {% load carton_tags %}
    {% get_cart as cart %}
    {% for product in cart.products %}
        {{ product }}
    {% endfor %}

request = context['request']
return cart_class(request.session, session_key=session_key)

register.assignment_tag(takes_context=True, name=CART_TEMPLATE_TAG_NAME)(get_cart)

register.simple_tag(takes_context=True, name=CART_TEMPLATE_TAG_NAME)(get_cart)
def get_cart(context, session_key=None, cart_class=Cart):
request = context['request']
return cart_class(request.session, session_key=session_key)`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant