How to use the summer.model.entry.Entry.update 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 update_entry(id):
    title = request.form['title']
    content = request.form['content']

    _entry = Entry.update(title, content, id)

    name = _entry['slug']
    create_time = _entry['create_time']
    status = _entry['status']

    if status == 'draft':
        # delete old file
        os.remove(os.path.join('./summer/_draft/', name + '.md'))

        # create new file
        filepath = os.path.join('./summer/_draft/', name + '.md')
    else:
        # delete old file
        os.remove(os.path.join('./summer/post/', name + '.md'))

        # create new file