예제 #1
0
    def get_form_defs(self):
        form_defs = []

        if djangoenv.has_installed(
                "shuup.simple_cms") or djangoenv.has_installed("shuup.xtheme"):
            form_defs.append(
                TemplatedWizardFormDef(
                    name="content",
                    template_name="shuup/admin/content/wizard.jinja",
                    form_class=ContentWizardForm,
                    context={
                        "title": _("Configure the initial content pages")
                    },
                    kwargs={"shop": self.object},
                ))

        if djangoenv.has_installed("shuup.notify") and djangoenv.has_installed(
                "shuup.front"):
            form_defs.append(
                TemplatedWizardFormDef(
                    name="behaviors",
                    template_name="shuup/admin/content/wizard.jinja",
                    form_class=BehaviorWizardForm,
                    context={"title": _("Configure some notifications")},
                    kwargs={"shop": self.object},
                ))

        return form_defs
예제 #2
0
 def get_form_defs(self):
     return [
         TemplatedWizardFormDef(
             name="sample",
             form_class=SampleObjectsWizardForm,
             template_name="shuup/admin/sample_data/wizard.jinja",
             kwargs={"shop": self.object})
     ]
예제 #3
0
    def get_form_defs(self):
        context = get_theme_context()
        if not context["current_theme"] and len(context["theme_classes"]) > 0:
            context["current_theme"] = context["theme_classes"][0]

        return [
            TemplatedWizardFormDef(
                template_name="shuup/xtheme/admin/wizard.jinja",
                name="theme",
                form_class=ActivationForm,
                context=context
            )
        ]
예제 #4
0
 def get_form_defs(self):
     return [
         TemplatedWizardFormDef(
             name="shop",
             template_name="shuup/admin/shops/_wizard_base_shop_form.jinja",
             extra_js="shuup/admin/shops/_wizard_base_shop_script.jinja",
             form_class=ShopWizardForm,
             kwargs={
                 "instance": self.object,
                 "languages": settings.LANGUAGES
             }),
         WizardFormDef(name="address",
                       form_class=ShopAddressWizardForm,
                       kwargs={"instance": self.object.contact_address})
     ]
예제 #5
0
    def get_form_defs(self):
        service_provider_form_defs = self._get_service_provider_form_defs()

        if self.request.method == "POST":
            active_providers = self.request.POST.get(self.base_name +
                                                     "-providers").split(",")
            service_provider_form_defs = list(
                filter(lambda x: x.name in active_providers,
                       service_provider_form_defs))
        return [
            TemplatedWizardFormDef(
                name=self.base_name,
                template_name=
                "shuup/admin/service_providers/_wizard_service_provider_base_form.jinja",
                extra_js="shuup/admin/service_providers/_wizard_script.jinja",
                form_class=ServiceProviderTypeForm,
                kwargs={"label": self.provider_label})
        ] + service_provider_form_defs
예제 #6
0
파일: _theme.py 프로젝트: yashodhank/shuup
    def get_form_defs(self):
        shop = self.object
        context = cached_load("SHUUP_XTHEME_ADMIN_THEME_CONTEXT")(shop)
        context.update({"shop": shop})

        current_theme_class = (context["current_theme"]
                               or context["theme_classes"][0])
        current_theme_settings = ThemeSettings.objects.get_or_create(
            shop=shop, theme_identifier=current_theme_class.identifier)[0]
        context["active_stylesheet"] = current_theme_settings.data.get(
            "settings", {}).get("stylesheet", None)

        return [
            TemplatedWizardFormDef(
                template_name="shuup/xtheme/admin/wizard.jinja",
                name="theme",
                form_class=ActivationForm,
                context=context)
        ]
예제 #7
0
    def get_form_defs(self):
        form_defs = []

        context = {
            "opt_in": not telemetry.is_opt_out(),
            "is_grace": telemetry.is_in_grace_period(),
            "last_submission_time": telemetry.get_last_submission_time(),
            "submission_data": telemetry.get_telemetry_data(request=self.request, indent=2),
            "title": _("Telemetry")
        }
        form_defs.append(
            TemplatedWizardFormDef(
                name=self.identifier,
                template_name="shuup/admin/system/telemetry_wizard.jinja",
                form_class=TelemetryWizardForm,
                context=context,
                kwargs={"shop": self.object}
            )
        )
        return form_defs
예제 #8
0
파일: 53245_views.py 프로젝트: wanuop/shuup
    def get_form_defs(self):
        context = get_theme_context()
        if not context["current_theme"] and len(context["theme_classes"]) > 0:
            context["current_theme"] = context["theme_classes"][0]

        theme_settings = ThemeSettings.objects.filter(
            theme_identifier=context["current_theme"].identifier).first()
        if theme_settings:
            context["active_stylesheet"] = theme_settings.data.get(
                "settings", {}).get("stylesheet", None)
        else:
            context["active_stylesheet"] = context["current_theme"](
            ).get_default_style().get("stylesheet", None)

        return [
            TemplatedWizardFormDef(
                template_name="shuup/xtheme/admin/wizard.jinja",
                name="theme",
                form_class=ActivationForm,
                context=context)
        ]