Take a look at your database schema and make sure that table actually
has a unique key for the `foo` column.

_Nik

On 5/11/2012 1:16 PM, . wrote:
> Hi there,
>
> Here is my class:
>
> MyClass(User):
>   foo = IPAddressField(unique=True)
>
> unique doesn't work:
>
> python manage.py shell
>
> from myproject.models import MyClass
> bar = MyClass(foo="12", username="first", password="secret")
> bar.save()
>
> baz = MyClass(foo="12", username="second", password="secret")
> baz.save()
>
> It should raise an exception, but there is no one.
> (username's unique=True works.)
>
> Do you have any ideas?
> Are there any other ways to make a unique field?
>
>
> Regards
>

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

Reply via email to