'NoReverseMatch at when calling url

I can't work out why im getting this error NoReverseMatch at / when calling <a href="{% url 'show_token_details' token.id %}">

def show_token_details(request,token_id):
    token = Token.objects.get(token_id == token_id)

    return render(request, 'ecommerceproductdetails.html', {})

path("token/<int:token_id>", views.show_token_details, name='show_token_details'),

What am I missing here?

Updated:

Reverse for 'show_token_details' with arguments '('',)' not found. 2 pattern(s) tried: ['token/(?P<token_id>[0-9]+)\\Z', 'token/(?P<token_id>[0-9]+)\\Z']

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source