예제 #1
0
def edit_tv(url_name):
    tv = TV.get(url_name)
    edit_tv = True
    eidt_succ = False

    if request.method == 'POST':
        form = request.form
        cn_name = form.get('cn_name').strip()
        origin_name = form.get('origin_name').strip()
        aka_name = list_item(form, 'aka_name')
        directors = list_item(form, 'directors')
        casts = list_item(form, 'casts')
        writers = list_item(form, 'writers')
        languages = list_item(form, 'languages')
        countries = list_item(form, 'countries')
        summary = form.get('summary').strip()
        is_ended = int(form.get('is_ended', 0))

        if not cn_name:
            error = '请填写剧集中文名称'
            return render_template('add_edit.html', **locals())

        TV.updateTV(cn_name=cn_name, url_name=url_name, origin_name=origin_name,
                aka_name=aka_name, directors=directors, casts=casts, writers=writers,
                languages=languages, countries=countries, summary=summary,
                is_ended=is_ended)
        edit_succ = True
        return render_template('add_edit.html', **locals())

    if tv:
        cn_name = tv.cn_name
        url_name = tv.url_name
        origin_name = tv.origin_name
        aka_name = tv.aka_name
        directors = tv.directors
        casts = tv.casts
        writers = tv.writers
        languages = tv.languages
        countries = tv.countries
        summary = tv.summary
        is_ended = tv.is_ended
        return render_template('add_edit.html', **locals())
    else:
        abort(404)
예제 #2
0
파일: tv.py 프로젝트: pombredanne/zjsq
def tvname(uname):
    tv = TV.get(uname)
    if tv:
        return 'tv %s' % tv.name
    else:
        abort(404)