Exemplo n.º 1
0
def delete_catalog(ctlg_id):
    """Delete an example object"""
    catalog = CatalogModel.get_by_id(ctlg_id)
    if request.method == "POST":
        try:
            catalog.key.delete()
            flash(u'Catalog %s successfully deleted.' % ctlg_id, 'success')
            return redirect(url_for('list_catalogs'))
        except CapabilityDisabledError:
            flash(u'App Engine Datastore is currently in read-only mode.', 'info')
            return redirect(url_for('list_catalogs'))    
Exemplo n.º 2
0
def edit_catalog(ctlg_id):
    catalog = CatalogModel.get_by_id(ctlg_id)
    form = CatalogForm(obj=catalog)
    if request.method == "POST":
        if form.validate_on_submit():
            catalog.ctlg_name = form.data.get('ctlg_name')
            catalog.ctlg_desc = form.data.get('ctlg_desc')
            catalog.put()
            flash(u'Catalog %s successfully saved.' % ctlg_id, 'success')
            return redirect(url_for('list_catalogs'))
    return render_template('edit_catalog.html', catalog=catalog, form=form)
Exemplo n.º 3
0
def edit_catalog(ctlg_id):
    catalog = CatalogModel.get_by_id(ctlg_id)
    form = CatalogForm(obj=catalog)
    if request.method == "POST":
        if form.validate_on_submit():
            catalog.ctlg_name = form.data.get('ctlg_name')
            catalog.ctlg_desc = form.data.get('ctlg_desc')
            catalog.put()
            flash(u'Catalog %s successfully saved.' % ctlg_id, 'success')
            return redirect(url_for('list_catalogs'))
    return render_template('edit_catalog.html', catalog=catalog, form=form)
Exemplo n.º 4
0
def delete_catalog(ctlg_id):
    """Delete an example object"""
    catalog = CatalogModel.get_by_id(ctlg_id)
    if request.method == "POST":
        try:
            catalog.key.delete()
            flash(u'Catalog %s successfully deleted.' % ctlg_id, 'success')
            return redirect(url_for('list_catalogs'))
        except CapabilityDisabledError:
            flash(u'App Engine Datastore is currently in read-only mode.',
                  'info')
            return redirect(url_for('list_catalogs'))