Reverse for 'catalog_product' with arguments '()' and keyword arguments '{'product_slug': 'samsung-galaxy-s5-sm-g900f-16gb'}' not found. 0 pattern(s) tried: []
| Request Method: | GET |
|---|---|
| Request URL: | http://127.0.0.1:8000/catalog/smartphony/ |
| Django Version: | 1.8.2 |
| Exception Type: | NoReverseMatch |
| Exception Value: | Reverse for 'catalog_product' with arguments '()' and keyword arguments '{'product_slug': 'samsung-galaxy-s5-sm-g900f-16gb'}' not found. 0 pattern(s) tried: [] |
| Exception Location: | C:\Users\LAPTOP\djangoenvs\py34\lib\site-packages\django\core\urlresolvers.py in _reverse_with_prefix, line 496 |
| Python Executable: | C:\Users\LAPTOP\djangoenvs\py34\Scripts\python.exe |
| Python Version: | 3.4.3 |
| Python Path: | ['C:\\Users\\LAPTOP\\Desktop\\djangodev\\eshop', 'C:\\Users\\LAPTOP\\djangoenvs\\py34\\lib\\site-packages\\setuptools-18.0.1-py3.4.egg', 'C:\\Windows\\system32\\python34.zip', 'C:\\Users\\LAPTOP\\djangoenvs\\py34\\DLLs', 'C:\\Users\\LAPTOP\\djangoenvs\\py34\\lib', 'C:\\Users\\LAPTOP\\djangoenvs\\py34\\Scripts', 'C:\\Python34\\Lib', 'C:\\Python34\\DLLs', 'C:\\Users\\LAPTOP\\djangoenvs\\py34', 'C:\\Users\\LAPTOP\\djangoenvs\\py34\\lib\\site-packages'] |
| Server time: | Пт, 7 Авг 2015 21:07:01 +0300 |
In template C:\Users\LAPTOP\Desktop\djangodev\eshop\catalog\templates\categories\category.html, error at line 17
| 7 | <ol class="breadcrumb"> |
|---|---|
| 8 | <li><a href="/">Главная</a></li> |
| 9 | <li><a href="/catalog/">Каталог</a></li> |
| 10 | <li class="active">{{ c.category_name }}</li> |
| 11 | </ol> |
| 12 | </div> |
| 13 | <h1>{{ c.category_name }}</h1> |
| 14 | <br/><br/> |
| 15 | {% for p in products %} |
| 16 | <div class = "product_thumbnail"> |
| 17 |
<a href = "
{{ p.get_absolute_url }}
">-- Here the debugger shows the mistake |
18 |
<img src = "{{ MEDIA_URL }}/catalog/products/thumbnails/{{ p.product_image }}" alt = "{{ p.product_name }}" class = "bn" /> |
| 19 | <br/> |
| 20 | {{ p.product_name }} |
| 21 | </a> |
| 22 | </div> |
| 23 | {% endfor %} |
| 24 |
|
| 25 | {% endblock %} |
You don't have a URL named 'catalog_product'. Check your URL's, it looks like you are passing an arg and a kwarg to the second pattern.
-James
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a9d529d0-57fb-418d-9d21-f92168e5a284%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
For a 'catalog_product' URL, you need to provide two slug arguments, one for the category and one for the product. Your permalink function only provides a value for product_slug, which is why there is no match against the regex.
You should also rewrite those functions to remove the @permalink decorator as its use is discouraged and deprecated. Use reverse() in the function body instead.
-James