Answer the question
In order to leave comments, you need to log in
How to remove an empty list item?
Good evening here is the model
class ItemStatus(models.Model):
name = models.CharField(max_length=200)
def __str__(self):
return self.name
class Item(models.Model):
name = models.CharField(max_length=200, unique=True)
status = models.ForeignKey(ItemStatus, default=None, null=True, blank=True, on_delete=models.CASCADE)
Answer the question
In order to leave comments, you need to log in
Make the field status
mandatory at the model level, that is, remove it null=True
andblank=True
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question