On Wed, Oct 3, 2012 at 8:14 AM, Tuss4 <
tuss...@gmail.com> wrote:
> This is my first time posting in the Django user group. I've been following
> the following lightbird Django by Example tutorials. I've hit a snag while
> following the blog tutorial (
http://lightbird.net/dbe/blog.html). The thing
> is my comment link [code]
>
> <div class="commentlink"><a href="{% url
blog.views.post post.pk
> %}">Comments</a></div>
>
> [/code]
>
> is not linking to the individual post. I checked my views.py and urls.py
> against the tutorial source code packet and it matches, but upon clicking it
> just displays the front page again. When you look at the url however you can
> see the posts primary key in the adress, but all posts are displayed.
>
> I'm ready to provide any information as needed. Thank you in advance for
> your help.
>
> In short, my blog isn't linking to individual posts.
>
So the URL generated looks "correct", but when you click on it, it
instead displays a different page?
That sounds like the URL is getting routed to the incorrect view.
Check your urls.py, does the view that gets displayed match the URL
(even partially)? Django will stop processing the urls.py for a
request once it has found the first URL regular expression that
matches the current URL.
Eg, if your urls.py has these patterns in it:
""
"blogs/(?P<blog_id>\d+)"
and then you request "/blogs/5", then the first regexp will match, and
it will not look any further. To stop this, you should properly start
and terminate your regular expressions with '^' and '$', which mean
start and end of string respectively:
"^$"
"^blogs/(?P<blog_id>\d+)$"
Cheers
Tom