django model remove duplicates code example
Example: django prevent duplicate entries
for instance in Stock.objects.all():
if instance.category == category:
raise forms.ValidationError(str(category) + ' is already created')
return category