Reverse for 'resetPasswordSendMail' with arguments '()' and keyword arguments '{}' not found. 1 pattern(s) tried: [u'$resetPasswordSendMail/$']

18 views
Skip to first unread message

Ajo Thomas

unread,
Jul 10, 2016, 9:45:59 AM7/10/16
to Django users
I am getting the error mentioned in the heading. The reverse url is working perfectly everywhere in the html code except in the form action part. The code works perfectly when I do not use namespaces in my project which right now has only one app. Example: {% url 'view_name' %} instead of {% url 'app_name:view_name' %} )

urls.py
from django.conf.urls import url, include
from django.contrib import admin
from account import views
from django.core.urlresolvers import reverse

app_name = 'account'

urlpatterns = [
    #url(r'^admin/', admin.site.urls),
    url(r'^$', views.login, name='login' ),
    url(r'^login/$', views.login, name='login'),
    url(r'^forgotPassword/$', views.forgotPassword, name='forgotPassword'),
    url(r'^resetPasswordSendMail/$', views.resetPasswordSendMail, name='resetPasswordSendMail'),
]


I am getting the error mentioned in the heading. The reverse url is working perfectly everywhere in the html code except in the form action part. The code works perfectly when I do not use namespaces in my project which right now has only one app. Example: {% url 'view_name' %} instead of {% url 'app_name:view_name' %} )

urls.py

from django.conf.urls import url, include
from django.contrib import admin
from account import views
from django.core.urlresolvers import reverse

app_name = 'account'

urlpatterns = [
    #url(r'^admin/', admin.site.urls),
    url(r'^$', views.login, name='login' ),
    url(r'^login/$', views.login, name='login'),
    url(r'^forgotPassword/$', views.forgotPassword, name='forgotPassword'),
    url(r'^resetPasswordSendMail/$', views.resetPasswordSendMail, name='resetPasswordSendMail'),
]

ForgotPassword.html

<form method="POST" role="form" id="forgotPassword" action="{% url 'account:resetPasswordSendMail' %}"> {% csrf_token %}


Views.py

def resetPasswordSendMail(request):
    # code follows....

ludovic coues

unread,
Jul 10, 2016, 2:56:03 PM7/10/16
to django...@googlegroups.com
Have you checked you didn't put a space between 'account: and resetPasswordSendMail' ?


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/54a41772-4ddd-4404-b2b1-90d6a2bae972%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Coues Ludovic
+336 148 743 42

James Schneider

unread,
Jul 11, 2016, 3:27:36 AM7/11/16
to django...@googlegroups.com


>
> urls.py
>
> from django.conf.urls import url, include
> from django.contrib import admin
> from account import views
> from django.core.urlresolvers import reverse
>
> app_name = 'account'
>
> urlpatterns = [
>     #url(r'^admin/', admin.site.urls),
>     url(r'^$', views.login, name='login' ),
>     url(r'^login/$', views.login, name='login'),
>     url(r'^forgotPassword/$', views.forgotPassword, name='forgotPassword'),
>     url(r'^resetPasswordSendMail/$', views.resetPasswordSendMail, name='resetPasswordSendMail'),
> ]
>

You have two URL's named 'login', that will cause problems later if it isn't already.

Is this your root urls.py file (in the same directory as your settings.py file)? I'm not sure you can set an app_name in that file. I believe that is designated for use within an app urls.py (appname/urls.py) that is read as part of include() from the root urls.py. I'm not in front of a computer to check, so I don't know if that's the case, and I may be incorrect.

-James

Reply all
Reply to author
Forward
0 new messages