Ejemplo n.º 1
0
def create_language():
    form = LanguageForm()
    if form.validate_on_submit():
        language = ProgrammingLanguage(name = form.name.data)
        language.put()
        flash('Programming language "%s" saved on the database.' % language.name)
        return redirect(url_for('list_languages'))
    return render_template('admin/languages/new.html', form=form)
Ejemplo n.º 2
0
def update_language(slug):
    form = LanguageForm()
    language = ProgrammingLanguage.all().filter('slug =', slug).get()
    if form.validate_on_submit():
        language.name = form.name.data
        language.put()
        flash('Programming language "%s" updated.' %language.name)
        return redirect(url_for('list_languages'))
    return render_template('admin/languages/edit.html', form=form, language=language)