コード例 #1
0
    def populate(self):
        for field in self.plugin.fields:
            if isinstance(field, tuple):
                name, value = field
                value.initial = self.plugin.config.get(name, value.initial)
                self.fields[name] = value

        self.fields[
            "vendor_review_options"] = XThemeSelect2ModelMultipleChoiceField(
                model="shuup_vendor_reviews.VendorReviewOption",
                label=_("Options"),
                help_text=_("Select the options you want to show"),
                required=True,
                initial=self.plugin.config.get("vendor_review_options"),
                extra_widget_attrs={"data-search-mode": "main"})
コード例 #2
0
ファイル: category_links.py プロジェクト: Bobby00/boss_shuup
    def populate(self):
        """
        A custom populate method to display category choices
        """
        for field in self.plugin.fields:
            if isinstance(field, tuple):
                name, value = field
                value.initial = self.plugin.config.get(name, value.initial)
                self.fields[name] = value

        self.fields["categories"] = XThemeSelect2ModelMultipleChoiceField(
            model="shuup.category",
            required=False,
            label=_("Categories"),
            initial=self.plugin.config.get("categories"),
            extra_widget_attrs={"data-search-mode": "visible"})
コード例 #3
0
ファイル: products_async.py プロジェクト: safouanenac/shuup
    def populate(self):
        """
        A custom populate method to display product choices
        """
        for field in self.plugin.fields:
            if isinstance(field, tuple):
                name, value = field
                value.initial = self.plugin.config.get(name, value.initial)
                self.fields[name] = value

        self.fields["products"] = XThemeSelect2ModelMultipleChoiceField(
            model="shuup.product",
            label=_("Products"),
            help_text=_("Select all products you want to show"),
            required=True,
            initial=self.plugin.config.get("products"),
            extra_widget_attrs={"data-search-mode": "main"})