Before I can write validation of uploaded images, I first need to know
how to save multiple upload images in view. Can anyone share some code
or reference on this? Thanks.
On Dec 20, 10:31 pm, Brandon Taylor wrote:
> Hi,
>
> You can do validation on images by using a custom form for your admin
>
Hi,
You can do validation on images by using a custom form for your admin
Model. This example validates that a thumbnail image is a specific
dimension, file type and file size,
from django.core.files.images import get_image_dimensions
class MyModelAdminForm(forms.ModelForm):
model = MyModel
Here is my model:
class Book(models.Model):
title = models.CharField(max_length=150)
category = models.CharField(max_length=50)
description = models.CharField(max_length=2000)
image1 = models.ImageField(upload_to='img/bk', blank=True)
image2 = models.ImageField(upload_to='img/
3 matches
Mail list logo