I tried to upload an .svg by the admin site to SQLite (django's default db) and I got the following error:
Upload a valid image. The file you uploaded was either not an image or a corrupted image.
I can upload .jpg files and it works properly.
class News(models.Model):
news_id = models.AutoField(primary_key=True, editable=False)
news_title = models.CharField(max_length=150)
news_date = models.DateTimeField(auto_now_add=True, editable=False)
news_body = models.TextField(max_length=1500)
news_img = models.ImageField(upload_to="pictures/%Y/%m/")
news_author = models.ManyToManyField(Author)
class Meta:
ordering: ['news_id']
def __str__(self):
return '%s %s %s'%(self.news_id, self.news_title, self.news_date)