Python Forum
Issue with Django only some links work?
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue with Django only some links work?
#12
The ones that have a title, description, or category that were entered with a lowercase first letter get this error:

Error:
Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/post/g3 Using the URLconf defined in commerce.urls, Django tried these URL patterns, in this order: admin/ [name='index'] login [name='login'] logout [name='logout'] register [name='register'] auction [name='auction'] watchlist [name='watchlist'] categories [name='categories'] post/<str:title><str:description><int:price><str:category> [name='post'] The current path, post/g3, didn't match any of these.
Which I assume is not matching because I entered it before I thought of matching case. I can fix that easy.

The ones that have the error I cant' figure out have this error:

Error:
AttributeError at /post/Keyboard20 'NoneType' object has no attribute 'description' Request Method: GET Request URL: http://127.0.0.1:8000/post/Keyboard20 Django Version: 3.0.8 Exception Type: AttributeError Exception Value: 'NoneType' object has no attribute 'description' Exception Location: C:\school\project2\commerce\auctions\views.py in post, line 93 Python Executable: C:\Python38\python.exe Python Version: 3.8.2 Python Path: ['C:\\school\\project2\\commerce', 'C:\\Python38\\python38.zip', 'C:\\Python38\\DLLs', 'C:\\Python38\\lib', 'C:\\Python38', 'C:\\Python38\\lib\\site-packages'] Server time: Sun, 13 Sep 2020 05:09:48 +0000 Traceback Switch to copy-and-paste view C:\Python38\lib\site-packages\django\core\handlers\exception.py in inner response = get_response(request) … ▶ Local vars C:\Python38\lib\site-packages\django\core\handlers\base.py in _get_response response = self.process_exception_by_middleware(e, request) … ▶ Local vars C:\Python38\lib\site-packages\django\core\handlers\base.py in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) … ▶ Local vars C:\school\project2\commerce\auctions\views.py in post print(query.description) … ▼ Local vars Variable Value category '0' description 'D' price 2 query None request <WSGIRequest: GET '/post/Keyboard20'> title 'Keyboar'
it had the title missing the last letter and the first letter as the description. I can't figure out exactly where the error is - has to be in views.py somewhere.

Here is a photo of all the actual listings and their 4 fields filled out:

[Image: JqQjzQV.png]

The ones that work are the Playstation, Monkey, And Jacky
Reply


Messages In This Thread
RE: Issue with Django only some links work? - by card51shor - Sep-13-2020, 05:11 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020