コード例 #1
0
ファイル: apps.py プロジェクト: zbidi/commcare-hq
def default_new_app(request, domain):
    """New Blank Application according to defaults. So that we can link here
    instead of creating a form and posting to the above link, which was getting
    annoying for the Dashboard.
    """
    meta = get_meta(request)
    track_app_from_template_on_hubspot.delay(request.couch_user,
                                             request.COOKIES, meta)
    if tours.NEW_APP.is_enabled(request.user):
        identify.delay(request.couch_user.username,
                       {'First Template App Chosen': 'blank'})
    lang = 'en'
    app = Application.new_app(domain, _("Untitled Application"), lang=lang)

    if not toggles.APP_MANAGER_V2.enabled(domain):
        # APP MANAGER V2 is completely blank on new app
        module = Module.new_module(_("Untitled Module"), lang)
        app.add_module(module)
        form = app.new_form(0, "Untitled Form", lang)

    if request.project.secure_submissions:
        app.secure_submissions = True
    clear_app_cache(request, domain)
    app.save()
    if toggles.APP_MANAGER_V2.enabled(request.domain):
        return HttpResponseRedirect(reverse('view_app', args=[domain,
                                                              app._id]))
    return HttpResponseRedirect(
        reverse('view_form', args=[domain, app._id, 0, 0]))
コード例 #2
0
ファイル: apps.py プロジェクト: dimagi/commcare-hq
def app_from_template(request, domain, slug):
    meta = get_meta(request)
    track_app_from_template_on_hubspot.delay(request.couch_user, request.COOKIES, meta)
    if tours.NEW_APP.is_enabled(request.user):
        identify.delay(request.couch_user.username, {"First Template App Chosen": "%s" % slug})
    clear_app_cache(request, domain)
    template = load_app_template(slug)
    app = import_app_util(template, domain, {"created_from_template": "%s" % slug})
    module_id = 0
    form_id = 0
    try:
        app.get_module(module_id).get_form(form_id)
    except (ModuleNotFoundException, FormNotFoundException):
        return HttpResponseRedirect(reverse("view_app", args=[domain, app._id]))
    return HttpResponseRedirect(reverse("view_form", args=[domain, app._id, module_id, form_id]))
コード例 #3
0
def app_from_template(request, domain, slug):
    meta = get_meta(request)
    track_app_from_template_on_hubspot.delay(request.couch_user, request.COOKIES, meta)
    clear_app_cache(request, domain)
    template = load_app_template(slug)
    app = import_app_util(template, domain, {
        'created_from_template': '%s' % slug,
    })
    module_id = 0
    form_id = 0
    try:
        app.get_module(module_id).get_form(form_id)
    except (ModuleNotFoundException, FormNotFoundException):
        return HttpResponseRedirect(reverse('view_app', args=[domain, app._id]))
    return HttpResponseRedirect(reverse('view_form_legacy', args=[domain, app._id, module_id, form_id]))
コード例 #4
0
ファイル: apps.py プロジェクト: nnestle/commcare-hq
def app_from_template(request, domain, slug):
    meta = get_meta(request)
    track_app_from_template_on_hubspot.delay(request.couch_user, request.COOKIES, meta)
    clear_app_cache(request, domain)
    template = load_app_template(slug)
    app = import_app_util(template, domain, {
        'created_from_template': '%s' % slug,
    })
    module_id = 0
    form_id = 0
    try:
        app.get_module(module_id).get_form(form_id)
    except (ModuleNotFoundException, FormNotFoundException):
        return HttpResponseRedirect(reverse('view_app', args=[domain, app._id]))
    return HttpResponseRedirect(reverse('form_source', args=[domain, app._id, module_id, form_id]))
コード例 #5
0
def app_from_template(request, domain, slug):
    meta = get_meta(request)
    track_app_from_template_on_hubspot.delay(request.couch_user, request.COOKIES, meta)
    if tours.NEW_APP.is_enabled(request.user):
        identify.delay(request.couch_user.username, {'First Template App Chosen': '%s' % slug})
    clear_app_cache(request, domain)
    template = load_app_template(slug)
    app = import_app_util(template, domain, {
        'created_from_template': '%s' % slug,
    })
    module_id = 0
    form_id = 0
    try:
        app.get_module(module_id).get_form(form_id)
    except (ModuleNotFoundException, FormNotFoundException):
        return HttpResponseRedirect(reverse('view_app', args=[domain, app._id]))
    return HttpResponseRedirect(reverse('view_form', args=[domain, app._id, module_id, form_id]))
コード例 #6
0
def default_new_app(request, domain):
    """New Blank Application according to defaults. So that we can link here
    instead of creating a form and posting to the above link, which was getting
    annoying for the Dashboard.
    """
    meta = get_meta(request)
    track_app_from_template_on_hubspot.delay(request.couch_user, request.COOKIES, meta)

    lang = 'en'
    app = Application.new_app(domain, _("Untitled Application"), lang=lang)
    add_ons.init_app(request, app)

    if request.project.secure_submissions:
        app.secure_submissions = True
    clear_app_cache(request, domain)
    app.save()
    return HttpResponseRedirect(reverse('view_app', args=[domain, app._id]))
コード例 #7
0
ファイル: apps.py プロジェクト: nnestle/commcare-hq
def default_new_app(request, domain):
    """New Blank Application according to defaults. So that we can link here
    instead of creating a form and posting to the above link, which was getting
    annoying for the Dashboard.
    """
    meta = get_meta(request)
    track_app_from_template_on_hubspot.delay(request.couch_user, request.COOKIES, meta)
    lang = 'en'
    app = Application.new_app(
        domain, _("Untitled Application"), lang=lang,
        application_version=APP_V2
    )
    module = Module.new_module(_("Untitled Module"), lang)
    app.add_module(module)
    form = app.new_form(0, "Untitled Form", lang)
    if request.project.secure_submissions:
        app.secure_submissions = True
    clear_app_cache(request, domain)
    app.save()
    return HttpResponseRedirect(reverse('form_source', args=[domain, app._id, 0, 0]))
コード例 #8
0
ファイル: apps.py プロジェクト: dimagi/commcare-hq
def default_new_app(request, domain):
    """New Blank Application according to defaults. So that we can link here
    instead of creating a form and posting to the above link, which was getting
    annoying for the Dashboard.
    """
    meta = get_meta(request)
    track_app_from_template_on_hubspot.delay(request.couch_user, request.COOKIES, meta)
    if tours.NEW_APP.is_enabled(request.user):
        identify.delay(request.couch_user.username, {"First Template App Chosen": "blank"})
    lang = "en"
    app = Application.new_app(domain, _("Untitled Application"), lang=lang)

    if not toggles.APP_MANAGER_V2.enabled(domain):
        # APP MANAGER V2 is completely blank on new app
        module = Module.new_module(_("Untitled Module"), lang)
        app.add_module(module)
        form = app.new_form(0, "Untitled Form", lang)

    if request.project.secure_submissions:
        app.secure_submissions = True
    clear_app_cache(request, domain)
    app.save()
    return HttpResponseRedirect(reverse("view_form", args=[domain, app._id, 0, 0]))