I'm trying to add object to my models that are unique and case insensitive so if I add 'car' first and then I try to add 'cAr' it should return an error. I don't know how to that, though. How can I make this happen?
This is the model:
class Food(models.Model):
name = models.CharField(max_length=100, unique=True)
def __str__(self):
return self.name
This is the serializer:
class FoodSerializer(serializers.ModelSerializer):
class Meta:
model = Food
fields = '__all__'