def edit_page_post(page_id: int):
    vm = EditPageViewModel(page_id)
    vm.process_form()

    if not vm.validate():
        return vm.to_dict()

    cms_service.update_page(vm.page_id, vm.title, vm.url, vm.contents)

    return flask.redirect('/admin/pages')
def add_page_post():
    vm = EditPageViewModel()
    vm.process_form()

    if not vm.validate():
        return vm.to_dict()

    cms_service.create_page(vm.title, vm.url, vm.contents, vm.user.email)

    return flask.redirect('/admin/pages')
コード例 #3
0
def edit_page_post(page_id: int):
    vm = EditPageViewModel(page_id)
    vm.process_form()

    if not vm.validate():
        log.notice(f"User cannot edit page: {vm.user.email}, {vm.error}.")
        return vm.to_dict()

    cms_service.update_page(vm.page_id, vm.title, vm.url, vm.contents, vm.is_shared)
    log.notice(f"User editing page: {vm.user.email}, {vm.title} --> {vm.url}.")

    return flask.redirect('/admin/pages')
コード例 #4
0
def add_page_post():
    vm = EditPageViewModel()
    vm.process_form()

    if not vm.validate():
        log.notice(f"User cannot add new page: {vm.user.email}, {vm.error}.")
        return vm.to_dict()

    cms_service.create_page(vm.title, vm.url, vm.contents, vm.user.email, vm.is_shared)
    log.notice(f"User adding new page: {vm.user.email}, {vm.title} --> {vm.url}.")

    return flask.redirect('/admin/pages')