Slide 32
Slide 32 text
DJANGO CMS BEST PRACTICES
HOW TO IMPLEMENT IT
Add contextual-aware links
current_post = getattr(self.request, BLOG_CURRENT_POST_IDENTIFIER)
if current_post:
admin_menu.add_modal_item(_('Edit Post'),
reverse(
'admin:djangocms_blog_post_change',
args=(current_post.pk,)
), active=True)
class PostDetailView(TranslatableSlugMixin, BaseBlogView, DetailView)
model = Post
def get_context_data(self, **kwargs):
context = super(PostDetailView, self).get_context_data(**kwargs)
setattr(self.request, BLOG_CURRENT_POST_IDENTIFIER, self.get_objec
return context