def get_editor_args(self): return { "languages": [{ "code": code, "name": get_language_name(code) } for code in to_language_codes(settings.LANGUAGES)], "variables": self.get_variable_data() }
def get_editor_args(self): return { "languages": [ { "code": code, "name": get_language_name(code) } for code in to_language_codes(settings.LANGUAGES) ], "variables": self.get_variable_data() }
def __init__(self, **kwargs): self.languages = to_language_codes(kwargs.pop("languages", ())) self.product = kwargs.pop("product") self.attributes = self.product.get_available_attribute_queryset() super(ProductAttributesForm, self).__init__(**kwargs) if self.product.pk: self.applied_attrs = dict((pa.attribute_id, pa) for pa in self.product.attributes.all()) else: self.applied_attrs = {} self._field_languages = {} self._build_fields()
def __init__(self, **kwargs): self.languages = to_language_codes(kwargs.pop("languages", ())) self.language_names = dict((lang, get_language_name(lang)) for lang in self.languages) self.product = kwargs.pop("product") self.attributes = self.product.get_available_attribute_queryset() self.trans_name_map = defaultdict(dict) self.translated_field_names = [] super(ProductAttributesForm, self).__init__(**kwargs) if self.product.pk: self.applied_attrs = dict((pa.attribute_id, pa) for pa in self.product.attributes.all()) else: self.applied_attrs = {} self._field_languages = {} self._build_fields()
def __init__(self, *args, **kwargs): self.product = kwargs.pop("product") self.languages = to_language_codes(kwargs.pop("languages", ())) kwargs.pop("empty_permitted") # this is unknown to formset super(BaseProductMediaFormSet, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): self.carousel = kwargs.pop("carousel") self.languages = to_language_codes(kwargs.pop("languages", ())) kwargs.pop("empty_permitted") super(SlideFormSet, self).__init__(*args, **kwargs)