Django models avoid duplicates
- by Hulk
In models,
class Getdata(models.Model):
title = models.CharField(max_length=255)
state = models.CharField(max_length=2, choices=STATE, default="0")
name = models.ForeignKey(School)
created_by = models.ForeignKey(profile)
def __unicode__(self):
return self.id()
In templates
<form>
<input type="submit" save the data/>
</form>
If the user clicks on the save button and the above data is saved in the table how to avoid the duplicates,i.e, if the user again clicks on the same submit button there should not be another entry for the same values.Or is it some this that has to be handeled in views
Thanks..