dimanche 12 juin 2016

Django - No Post matches the given query


Ive been building a blog via a tutorial in the book 'django by example'.

Im working on the part where a blog post can be shared via email, everything works fine when I run it until I click the 'share post' link under an entry and then I get the following 404

Page not found (404)
Request Method: GET
Request URL:    http://127.0.0.1:8000/blog/1/share/
Raised by:  blog.views.post_share
No Post matches the given query.

My understanding is that this is telling me the post can't be found from the db right? Well I have 3 test posts all visible in django admin and they are published and when I login via django shell I can see that all 3 posts are there too.

Ive gone over my code multiple times now and have the code that came with the book and cannot see anything amiss, here are the forms, views, models and urls files from the app of my project

https://github.com/davejonesbkk/mysite/blob/master/mysite/blog/forms.py
https://github.com/davejonesbkk/mysite/blob/master/mysite/blog/views.py
https://github.com/davejonesbkk/mysite/blob/master/mysite/blog/urls.py
https://github.com/davejonesbkk/mysite/blob/master/mysite/blog/models.py

Ive read some other threads here from people who had similar problems and tried moving my url patterns around a bit but that hasn't helped.

this is a screen grab of what the page should return when I try to share it too

screen grab

this is the full local url that is returning a 404 btw

http://127.0.0.1:8000/blog/1/share/

any help would be appreciated as Im stumped!


Aucun commentaire:

Enregistrer un commentaire