@app.route('/admin/filter/create/', methods=['GET', 'POST'])
@app.route('/admin/filter/<string:filter_id>/update/', methods=['GET', 'POST'], endpoint='filter_update')
@auth.admin_required
def filter_update(filter_id=''):
    if filter_id:
        filter_db = model.Filter.get_by_id(filter_id)
    else:
        filter_db = model.Filter(id='{}-{}'.format(util.param('filter_value'), util.param('filter_value')), label='')
    if ((not filter_db) or (not auth.current_user_db().admin)):
        return flask.abort(404)
    form = FilterUpdateForm(obj=filter_db)
    if form.validate_on_submit():
        form.populate_obj(filter_db)
        filter_db.put()
        return flask.redirect(flask.url_for('admin_filter_list'))
    return flask.render_template('filter/filter_update.html', html_class='filter-update', title=('%s' % (filter_db.label or 'فلتر جديد')), filter_db=filter_db, form=form, api_url=(flask.url_for('api.filter', key=filter_db.key.urlsafe()) if filter_db.key else ''))
@app.route('/admin/filter/create/', methods=['GET', 'POST'])
@app.route('/admin/filter/<string:filter_id>/update/', methods=['GET', 'POST'], endpoint='filter_update')
@auth.admin_required
def filter_update(filter_id=):
    if filter_id:
        filter_db = model.Filter.get_by_id(filter_id)
    else:
        filter_db = model.Filter(id='{}-{}'.format(util.param('filter_value'), util.param('filter_value')), label=)
    if ((not filter_db) or (not auth.current_user_db().admin)):
        return flask.abort(404)
    form = FilterUpdateForm(obj=filter_db)
    if form.validate_on_submit():
        form.populate_obj(filter_db)
        filter_db.put()
        return flask.redirect(flask.url_for('admin_filter_list'))
    return flask.render_template('filter/filter_update.html', html_class='filter-update', title=('%s' % (filter_db.label or 'فلتر جديد')), filter_db=filter_db, form=form, api_url=(flask.url_for('api.filter', key=filter_db.key.urlsafe()) if filter_db.key else ))