def __init__(self, *args, **kwargs): super(FoodsForm, self).__init__(*args, **kwargs) self.fields['icon'] = ImageField(image_type="icon", required=False) localize_form_fields(self) FOOD_ATTRIBUTES_INFO.set_form_fields(self)
def __init__(self, *args, **kwargs): super(FoodsForm, self).__init__(*args, **kwargs) typeclasses = TYPECLASS_SET.get_group("FOOD") choices = [(key, cls.typeclass_name + " (" + key + ")") for key, cls in typeclasses.items()] self.fields['typeclass'] = forms.ChoiceField(choices=choices) self.fields['icon'] = IconField(required=False) localize_form_fields(self) FOOD_ATTRIBUTES_INFO.set_form_fields(self)
def __init__(self, *args, **kwargs): super(FoodsForm, self).__init__(*args, **kwargs) objects = DATA_SETS.typeclasses.objects.filter(key="CLASS_FOOD") choices = [(obj.key, obj.name + " (" + obj.key + ")") for obj in objects] self.fields['typeclass'] = forms.ChoiceField(choices=choices) choices = [("", "---------")] objects = DATA_SETS.icon_resources.objects.all() choices.extend([(obj.key, obj.name + " (" + obj.key + ")") for obj in objects]) self.fields['icon'] = forms.ChoiceField(choices=choices, required=False) localize_form_fields(self) FOOD_ATTRIBUTES_INFO.set_form_fields(self)
def __init__(self, *args, **kwargs): super(FoodsForm, self).__init__(*args, **kwargs) typeclasses = TYPECLASS_SET.get_group("FOOD") choices = [(key, cls.typeclass_name + " (" + key + ")") for key, cls in typeclasses.items()] self.fields['typeclass'] = forms.ChoiceField(choices=choices) choices = [("", "---------")] objects = CM.ICON_RESOURCES.objects.all() choices.extend([(obj.key, obj.name + " (" + obj.key + ")") for obj in objects]) self.fields['icon'] = forms.ChoiceField(choices=choices, required=False) localize_form_fields(self) FOOD_ATTRIBUTES_INFO.set_form_fields(self)
def __init__(self, *args, **kwargs): super(FoodsForm, self).__init__(*args, **kwargs) localize_form_fields(self) FOOD_ATTRIBUTES_INFO.set_form_fields(self)
def __init__(self, *args, **kwargs): super(FoodsForm, self).__init__(*args, **kwargs) localize_form_fields(self) FOOD_ATTRIBUTES_INFO.set_form_fields(self)