コード例 #1
0
ファイル: admin.py プロジェクト: cloudorz/jzsadmin
def add_entry():
    form = EntryForm(request.form, next=request.args.get('next',''))
    cities = City.query.ascending(City.no)
    cates = Cate.query.ascending(City.no)

    if form.validate_on_submit():

        entry = Entry()
        entry.updated = now()
        entry.created = now()
        entry.init_counters()
        entry.city_label = request.form.get('city_label')
        form.populate_obj(entry)

        entry.save()
        flash(u"保存成功")

        next_url = form.next.data
        if not next_url:
            next_url = url_for('list_entry')

        return redirect(next_url)

    return render_template("admin/entry_add.html",form=form, cities=cities,
            cates=cates)
コード例 #2
0
ファイル: admin.py プロジェクト: py-prj-code/jzsadmin
def add_entry():
    form = EntryForm(request.form, next=request.args.get('next', ''))
    cities = City.query.ascending(City.no)
    cates = Cate.query.ascending(City.no)

    if form.validate_on_submit():

        entry = Entry()
        entry.updated = now()
        entry.created = now()
        entry.init_counters()
        entry.city_label = request.form.get('city_label')
        form.populate_obj(entry)

        entry.save()
        flash(u"保存成功")

        next_url = form.next.data
        if not next_url:
            next_url = url_for('list_entry')

        return redirect(next_url)

    return render_template("admin/entry_add.html",
                           form=form,
                           cities=cities,
                           cates=cates)
コード例 #3
0
ファイル: crawl_ganji.py プロジェクト: py-prj-code/jzsadmin
def save_content(data):
    print 'Saving...'

    e = Entry()
    e.location = '0.0,0.0'
    e.tags = set()
    e.updated = now()
    e.created = now()
    e.init_counters()
    e.city_label = data['city_label']
    e.title = data['title']
    e.brief = data['brief'] or " "
    e.desc = data['desc']
    e.address = data['address']
    e.worktime = data['worktime']
    e.serviceareas = data['serviceareas'] or set()
    e.serviceitems = set(data['serviceitems'])
    e.contracts = data['contracts']
    e.linkman = data['linkman'] or " "
    e.status = 'block'

    e.save()