1

I'm using django-registration(v.0.8) to implement registration. I overrode post_activation_redirect to send users to the page they originally requested by tacking a ?next=/my_next_page/ to the end of the URL.

def post_activation_redirect(self, request, user):
        if 'redirect' in request.GET:
            return request.session['redirect'], (), {}
        else:
            return 'top-free-games', (), {}

This works fine when redirect is defined, but I'm getting NoReverseMatch errors when it's undefined.

NoReverseMatch at /accounts/activate/d66aaee8a3411ab7a5e495dd024f00a91cd00bec/
Reverse for 'top-free-games' with arguments '()' and keyword arguments '{}' not found.

My urls.py is as follows:

urlpatterns = patterns('',
    url(r'^$', TopAppsView.as_view(), name='index'),
    url(r'^top-free-games/$', TopFreeAppsView.as_view(), name='top-free-apps'),
    ....

This is an app, and the urls are imported through this line:

url(r'^app-sales-data/', include('arpu.urls', namespace="arpu")),

Is there a good way to systematically debug something like this? I've tried trial and error over and over and it doesn't seem to be digging anything up.

1 Answer 1

0

For reverse, you need to specify the URL Pattern Name, not the URL path. so, change 'top-free-games' to 'top-free-apps' since that is the name of the url you have specified here:

url(r'^top-free-games/$', TopFreeAppsView.as_view(), name='top-free-apps')
3
  • Thanks. This was a typo, but not the core issue. I made the change and I'm still getting: Reverse for 'top-free-apps' with arguments '()' and keyword arguments '{}' not found. Jul 9, 2013 at 13:57
  • should it not be 'arpu:top-free-apps' ?
    – karthikr
    Jul 9, 2013 at 13:58
  • Yes, that got it. Thanks so much! Jul 9, 2013 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.