python - Django - No Post matches the given query -
ive been building blog via tutorial in book 'django example'.
im working on part blog post can shared via email, works fine when run until click 'share post' link under entry , following 404
page not found (404) request method: request url: http://127.0.0.1:8000/blog/1/share/ raised by: blog.views.post_share no post matches given query.
my understanding telling me post can't found db right? have 3 test posts visible in django admin , published , when login via django shell can see 3 posts there too.
ive gone on code multiple times , have code came book , cannot see amiss, here forms, views, models , urls files app of 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 other threads here people had similar problems , tried moving url patterns around bit hasn't helped.
this screen grab of page should return when try share too
this full local url returning 404 btw
http://127.0.0.1:8000/blog/1/share/
any appreciated im stumped!
you having simple typo in code:
post = get_object_or_404(post, id=post_id, status='pubished')
i guess should 'published'
.
Comments
Post a Comment