How to use the summer.model.entry.Entry.update_status function in summer

To help you get started, we’ve selected a few summer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gaowhen / summer / summer / view / post / post.py View on Github external
def publish_draft(id):
    status = request.form['status']

    entry = Entry.update_status(id, status)

    slug = entry['slug']

    draft_file = os.path.join('./summer/_draft/', slug + '.md')
    post_file = os.path.join('./summer/post/', slug + '.md')

    if status == 'publish':
        os.rename(draft_file, post_file)
    elif status == 'draft':
        os.rename(post_file, draft_file)

    return jsonify(r=True)