Django for Designers: Difference between revisions
Content added Content deleted
imported>Paulproteus (→Part 2: URLs, basic views, templates, static files: Removed, by moving it to a new page) |
|||
Line 632: | Line 632: | ||
Then, we'll need to have our views.py file import the bookmark model and send data to the index view. |
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"> |
<source lang="python"> |
||
from django.shortcuts import render |
|||
from bookmarks.models import Bookmark |
from bookmarks.models import Bookmark |
||
</source> |
|||
And we'll edit index(request): |
|||
<source lang="python"> |
|||
def index(request): |
def index(request): |
||
bookmarks = Bookmark.objects.all() |
bookmarks = Bookmark.objects.all() |
||
Line 659: | Line 663: | ||
</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. |
||
<source lang="python"> |
<source lang="python"> |