[Fixed]-Django registration redux URL's being effected by url with multiple query parameters

1👍

The problem is your url ordering, take a look at this:

url(r'^admin/', include(admin.site.urls)),
url(r'', include('howdidu.urls')),
url(r'^accounts/register/$', MyRegistrationView.as_view(), name='registration_register'), #redirects to home page after registration
url(r'^accounts/', include('registration.backends.simple.urls')),

Especially this:

url(r'', include('howdidu.urls')),

this url matches everything, so basically Django will go from the top to the bottom and if it doesn’t find any match before url(r'', include('howdidu.urls')), it will match anything to it. This means that you will never match

url(r'^accounts/register/$', MyRegistrationView.as_view(), name='registration_register'), #redirects to home page after registration
url(r'^accounts/', include('registration.backends.simple.urls')),

One way to fix it is to place url(r'', include('howdidu.urls')) at the very bottom of the urls:

url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/register/$', MyRegistrationView.as_view(), name='registration_register'), #redirects to home page after registration
url(r'^accounts/', include('registration.backends.simple.urls')),
url(r'^', include('howdidu.urls')),

and another way is to set another url level for url(r'^', include('howdidu.urls')):

url(r'^admin/', include(admin.site.urls)),
url(r'^howdidu/', include('howdidu.urls')),
url(r'^accounts/register/$', MyRegistrationView.as_view(), name='registration_register'), #redirects to home page after registration
url(r'^accounts/', include('registration.backends.simple.urls')),
👤pythad

Leave a comment