Reputation: 21
I need to make upload image in django admin panel as a mandatory field, is there any possibility?
Here what i did:
models.py
class ContentData(models.Model):
title = models.CharField(max_length=100,null = True)
description = models.TextField(null=True)
image = models.ImageField(upload_to="uploads", blank=True)
is_active = models.IntegerField(default = 1,
blank = True,
null = True,
help_text ='1->Active, 0->Inactive',
choices =(
(1, 'Active'), (0, 'Inactive')
))
created_on = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.title
Upvotes: 0
Views: 249