White Dog
White Dog

Reputation: 50

Django "NoReverseMatch" Error

I'm working with django and there's the relevant code in my HTML file:

<form action="{% url 'users: check' %}" method="post">

I'm hoping that the form's data be sent to the method "check" in a app named users. In /user folder there's urls.py with relevant code:

app_name = users
urlpatterns = [
    path('check', views.check, name='check'),
]

And there's indeed a method called check in my views.py. But when I tried to get to the website I got the ERROR:

NoReverseMatch at /users/login

Reverse for ' check' not found. ' check' is not a valid view function or pattern name.

I can't figure out what's the problem. Everything seems to be set well.

Django version is 2.0 and Python 3.4.

Upvotes: 1

Views: 61

Answers (1)

Exprator
Exprator

Reputation: 27533

<form action="{% url 'users:check' %}" method="post">

you cant give space after : in the url

or if its the same page where you are POSTING data

then you can simply use this

<form action="" method="post">

Upvotes: 1

Related Questions