Example #1
0
def create_app():
    if not session.get_admin_account():
        return abort(403)

    if request.method == 'POST':
        application = Application()
        application.name = request.form.get('app_name')
        application.created_at = datetime.utcnow()
        application.admins = [session.get_admin_account()]
        application.save()

        return redirect(url_for('console.app_state', app_id=application.id))

    return render_template('developer/console/app/create.html', is_super_user=is_super_user())