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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to