Skip to content

Commit

Permalink
added PostDetail view
Browse files Browse the repository at this point in the history
  • Loading branch information
brosner committed Nov 14, 2011
1 parent d94f7af commit 0828c45
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions biblion/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ class Meta:

objects = PostManager()

def get_absolute_url(self):
return reverse("biblion_post_detail", kwargs={"slug": self.slug})

def __unicode__(self):
return self.title

Expand Down
1 change: 1 addition & 0 deletions biblion/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
url(r"^blog/(?P<slug>[\w-]+)/$", biblion.views.BiblionDetail.as_view(), name="biblion_detail"),
url(r"^blog/(?P<slug>[\w-]+)/update/$", biblion.views.BiblionUpdate.as_view(), name="biblion_update"),
url(r"^blog/(?P<slug>[\w-]+)/post/$", biblion.views.PostCreate.as_view(), name="biblion_post_create"),
url(r"^post/(?P<slug>[\w-]+)/$", biblion.views.PostDetail.as_view(), name="biblion_post_detail"),
)
5 changes: 5 additions & 0 deletions biblion/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ def dispatch(self, *args, **kwargs):
return super(PostCreate, self).dispatch(*args, **kwargs)


class PostDetail(DetailView):

model = Post


def blog_post_add(request, blog_slug, post_form=PostForm, **kwargs):

blog = get_object_or_404(Blog, slug=blog_slug)
Expand Down

0 comments on commit 0828c45

Please sign in to comment.