コード例 #1
0
ファイル: post.py プロジェクト: smitelli/windowbox
    def get(cls, post_id=None, as_json=False):
        render = cls._render_json if as_json else cls._render_html

        post = get_or_404(PostManager.get_by_id, post_id)
        attachment = get_or_404(post.get_attachment)
        metadata = attachment.get_metadata()
        previous, next = PostManager.get_adjacent_by_id(post_id)

        return render(post, attachment, metadata, previous, next)