Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 726
BryanWheelock Avatar asked Dec 03 '09 19:12

BryanWheelock


1 Answers

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

like image 68
Jiaaro Avatar answered Sep 30 '22 13:09

Jiaaro