Created
January 29, 2014 16:07
-
-
Save robrocker7/8691214 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# URL in urls.py | |
url(r'blog/(?P<post_id>[\d]+)/$', 'blog_post', name='blog_post'), | |
# VIEW in views.py | |
def blog_post(request, post_id): | |
post=BlogPost.objects.get(id=blog_id) | |
return render(request, 'blog_post.html', { | |
'post':post, | |
}) | |
# HTML in template somewhere | |
<div class="blog"> | |
<div class="blog-title">{{ post.title }}</div> | |
<div class="blog-body">{{ post.body }}</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment