Example #1
0
    def save_model(self, request, object, form, change):
        super(CategoryAdmin, self).save_model(request, object, form, change)

        category_photo = CategoryPhoto()
        image = form.cleaned_data.get('photo_upload')

        if image:
            category_photo.file = image
            category_photo.save()
            object.image = category_photo
            object.save()
Example #2
0
    def save_model(self, request, object, form, change):
        super(CategoryAdmin, self).save_model(request, object, form, change)

        category_photo = CategoryPhoto()
        image = form.cleaned_data.get('photo_upload')

        if image:
            category_photo.file = image
            category_photo.save()
            object.image = category_photo
            object.save()