how to remove duplicates in djnago 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