[Answered ]-Django registration opens other template

2πŸ‘

βœ…

It looks like the problem is that /address_book/register/ matches your client url, which comes before the register URL. To fix that, one way to fix this would be to switch the order of the URL strings:

# urls.py
urlpatterns = patterns('',
        url(r'^$', views.index, name='index'),
        url(r'^add_client/$', views.add_client, name='add_client'),
        url(r'^register/$', views.register, name = 'register'),
        url(r'^(?P<client_name_slug>[\w\-]+)/$', views.client, name='client'),
)

However, it would be better to call the URL by its name in your base.html instead of relying on the order of the URL strings:

# base.html
...
<li><a href="{% url 'register' %}">Register here</a></li>
...

Leave a comment