Django for Designers: Difference between revisions

imported>Paulproteus
(→‎Part 2: URLs, basic views, templates, static files: Removed, by moving it to a new page)
 
Then, we'll need to have our views.py file import the bookmark model and send data to the index view.
 
We'll add an import statement:
 
<source lang="python">
from django.shortcuts import render
from bookmarks.models import Bookmark
</source>
 
And we'll edit index(request):
 
<source lang="python">
def index(request):
bookmarks = Bookmark.objects.all()
</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. So we can write:
 
<source lang="python">
Anonymous user