예제 #1
0
    def save(self):
        _title = self.cleaned_data.get('title')
        _category = self.cleaned_data.get('category')
        _icon = self.cleaned_data.get('icon')

        _status = self.cleaned_data.get('status')
        _status = int(_status)

        if _icon:
            log.info("icon %s" % _icon)
            image_file = HandleImage(_icon)
            icon_file = image_file.icon_save(path=image_path)
            self.sub_category.icon = icon_file

        self.sub_category.title = _title
        self.sub_category.group_id = _category
        self.sub_category.status = _status
        self.sub_category.save()
예제 #2
0
    def save(self):
        _title = self.cleaned_data.get('title')
        _category = self.cleaned_data.get('category')
        _icon = self.cleaned_data.get('icon')

        _status = self.cleaned_data.get('status')
        _status = int(_status)

        sub_category = Sub_Category(
            title = _title,
            group_id = _category,
            status = _status,
        )

        if _icon:
            image_file = HandleImage(_icon)
            icon_file = image_file.icon_save(path=image_path)
            sub_category.icon = icon_file

        sub_category.save()
        return sub_category
예제 #3
0
 def _handle_post_image(self, form_field_name):
     _image = HandleImage(image_file=self.cleaned_data.get(form_field_name))
     _image_path = _image.icon_save()
     return _image_path
예제 #4
0
 def handle_post_image_by_name(self, image_name):
     _image = HandleImage(image_file=self.cleaned_data.get(image_name))
     _image_path = _image.icon_save()
     return _image_path