Exemple #1
0
def apps_new():
    form = forms.AppForm()
    if form.validate_on_submit():
        models.apps_new(form)
        return redirect('/apps')

    form.app_id.data = models.auto_created()
    form.app_id.readonly = True
    form.app_key.data = models.auto_created()
    form.app_key.readonly = True
    form.app_secret.data = models.auto_created()
    form.app_secret.readonly = True
    form.facebook_api_version.choices = models.facebook_api_version_choices()
    form.status.choices = models.app_status_choices()
    
    return render_template('apps/apps_edit.html',
                           form = form, h = helpers)
Exemple #2
0
def apps_edit(app_id):
    app = models.apps_detail(app_id)
    if not app:
        return abort(404)

    form = forms.AppForm()
    if form.validate_on_submit():
        models.apps_edit(form)
        return redirect('/apps')

    form.app_id.data = app['app_id']
    form.app_id.readonly = True
    form.app_key.data = app['app_key']
    form.app_key.readonly = True
    form.app_secret.data = app['app_secret']
    form.app_secret.readonly = True
    form.app_name.data = app['app_name']

    form.support_android.data = app['support_android']
    form.support_playstore.data = app['support_playstore']
    form.playstore_url.data = app['playstore_url']
    form.gcm_sender_id.data = app['gcm_sender_id']
    form.gcm_server_api_key.data = app['gcm_server_api_key']
    form.gcm_config_path.data = app['gcm_config_path']

    form.support_ios.data = app['support_ios']
    form.appstore_url.data = app['appstore_url']

    form.support_gameflier.data = app['support_gameflier']
    form.gameflier_url.data = app['gameflier_url']

    form.facebook_app_id.data = app['facebook_app_id']
    form.facebook_app_name.data = app['facebook_app_name']
    form.facebook_app_secret.data = app['facebook_app_secret']
    form.facebook_api_version.choices = models.facebook_api_version_choices()
    form.facebook_api_version.data = models.facebook_api_version_index(app['facebook_api_version'])

    form.status.choices = models.app_status_choices()
    form.status.data = models.app_status_index(app['status'])

    return render_template('apps/apps_edit.html',
                           form = form, h = helpers)