示例#1
0
 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()
     }
示例#3
0
文件: forms.py 项目: charn/shoop
 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()
示例#4
0
 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()
示例#5
0
文件: forms.py 项目: superheo/shoop
 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()
示例#6
0
 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()
示例#7
0
 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)
示例#8
0
文件: forms.py 项目: superheo/shoop
 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)
示例#9
0
 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)