Hi, can any one help me please.

28 views
Skip to first unread message

goitom negash

unread,
Aug 12, 2019, 7:29:40 AM8/12/19
to Django users
the following error is displayed when i try to write a function named as display_laptop to display the available laptops in the backend.

NoReverseMatch at /

Reverse for 'display_laptop' not found. 'display_laptop' is not a valid view function or pattern name.
Request Method:GET
Request URL:http://127.0.0.1:8000/
Django Version:2.2.3
Exception Type:NoReverseMatch
Exception Value:
Reverse for 'display_laptop' not found. 'display_laptop' is not a valid view function or pattern name.
Exception Location:C:\Users\Goitom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\resolvers.py in _reverse_with_prefix, line 668
Python Executable:C:\Users\Goitom\AppData\Local\Programs\Python\Python37-32\python.exe
Python Version:3.7.4
Python Path:
['C:\\Users\\Goitom\\Desktop\\shop',
 'C:\\Users\\Goitom\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.zip',
 'C:\\Users\\Goitom\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs',
 'C:\\Users\\Goitom\\AppData\\Local\\Programs\\Python\\Python37-32\\lib',
 'C:\\Users\\Goitom\\AppData\\Local\\Programs\\Python\\Python37-32',
 'C:\\Users\\Goitom\\AppData\\Roaming\\Python\\Python37\\site-packages',
 'C:\\Users\\Goitom\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages']
Server time:Mon, 12 Aug 2019 11:12:59 +0000

DPM

unread,
Aug 12, 2019, 8:03:11 AM8/12/19
to django...@googlegroups.com
Can u plz show the code where this error coming... 

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d81e5cbf-ebf1-46f7-9a8f-8406440a0f4b%40googlegroups.com.

Sundararajan Seshadri

unread,
Aug 12, 2019, 9:11:28 AM8/12/19
to Django users
It means that there is no line in urls.py of the main application with the name as 'display_laptop'. Probably you are confused with the action and name. Action should be a callable and should be imported in urls.py file. Name is the name of the route and it appears within quote (normally).

Typically a url is: [url_pattern, callable, {additional parameters or empty}, name='display_laptop']

if you are going to write a function called display_laptop, import it into the urls.py and in the above url, replace callable with display_laptop (no quote); that is:

from .... import display_laptop

urlpatterns = [ [.....], [url_pattern, display_laptop,{..}, name='display_laptop'],....]

Cheers.
=============================================
Reply all
Reply to author
Forward
0 new messages