Django for Designers: Difference between revisions

Content added Content deleted
imported>Paulproteus
(→‎Curriculum: Add part 5 link)
Line 664: Line 664:
</source>
</source>


We also want our tag view to show real bookmarks. We only want to show bookmarks that have been tagged with the given tag.
We also want our tag view to show real bookmarks. We only want to show bookmarks that have been tagged with the given tag. So we'll edit the import statement we just added:


<source lang="python">
<source lang="python">
from django.shortcuts import render
from bookmarks.models import Bookmark, Tag
from bookmarks.models import Bookmark, Tag
</source>


And alter the tag() definition as well:


<source lang="python">
[...]

def tag(request, tag_name):
def tag(request, tag_name):
tag = Tag.objects.get(slug=tag_name)
tag = Tag.objects.get(slug=tag_name)