On 20-8-2012 0:16, Joseph Mutumi wrote:
> That particular field at times appears multiple times in the database. How
> do I make it
> only have distinct values?
>
> This is a snippet, drop down will have repeated values if same color is
> entered:
>
> class FavoriteColor(models.Model):
> color = models.CharField(max_length=255)
>
> def __unicode__(self):
> return self.color
You should invest in fixing the flaw in the design. Set the unique
attribute on the color field after you manually remove all duplicates
from the database.
--
Melvyn Sopacua