I getting a 'Reverse for 'views.mainPage' with arguments '()' and keyword arguments '{}' not found.'

StackOverflow https://stackoverflow.com/questions/14452700

Frage

I getting a 'Reverse for 'views.mainPage' with arguments '()' and keyword arguments '{}' not found.'

mainPage method in /django_crm/crm/views.py

@login_required
def mainPage(request):
    variables = RequestContext(request, {
            'user': request.user,
            })  

    return render_to_response('mainPage.html', variables)

and /django_crm/django_crm/templates/mainPage.html

<html>
    <head>
        <title>test</title>
    </head>
    <body>
        {% url 'crm.views.mainPage' %}
    </body>
</html>

Error...

Reverse for ''crm.views.mainPage'' with arguments '()' and keyword arguments '{}' not found.
War es hilfreich?

Lösung

{% load url from future %} if you are using django < 1.5

Or

Remove quotes from url tag.

Changed in Django 1.5: The first parameter used not to be quoted, which was inconsistent with other template tags. Since Django 1.5, it is evaluated according to the usual rules: it can be a quoted string or a variable that will be looked up in the context.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top