Reverse for '*' with arguments '()' and keyword arguments '{}' not found

BryanWheelock picture BryanWheelock · Dec 3, 2009 · Viewed 137k times · Source

Caught an exception while rendering:

Reverse for 'products.views.'filter_by_led' with arguments '()' and keyword arguments '{}' not found.

I was able to successfully import products.views.filter_by_led from the shell and it worked so the path should be correct.

Here is the urls.py:

(r'^led-tv/$', filter_by_led ),

This is where the error is being generated:

href="{% url products.views.filter_by_led %}">

Which I can't understand because this works fine from the same file:

{% url products.views.lcd_screen_size screen_size=50 %}

Here is the function definition:

def filter_by_led(request):

I don't understand why Django would think that the function would not be able to find the Reverse for that function.

I deleted all the *.pyc files and restarted Apache.

What am I doing wrong?

Answer

Jiaaro picture Jiaaro · Dec 3, 2009

There are 3 things I can think of off the top of my head:

  1. Just used named urls, it's more robust and maintainable anyway
  2. Try using django.core.urlresolvers.reverse at the command line for a (possibly) better error

    >>> from django.core.urlresolvers import reverse
    >>> reverse('products.views.filter_by_led')
    
  3. Check to see if you have more than one url that points to that view