Thanks Alex, that worked.

Alex Koshelev wrote:
> Hi, Vasil!
>
> `Field.unique` is the read only property. If you want to set 
> uniqueness you have to assign field's `_unique` attribute to True.
>
> ---
> Alex Koshelev
>
>
> On Wed, Aug 5, 2009 at 12:54 AM, Vasil Vangelovski 
> <vvangelov...@gmail.com <mailto:vvangelov...@gmail.com>> wrote:
>
>
>     Having this line of code:
>
>     User._meta.get_field('is_staff').default = True
>     in the models.py for one of my apps works without problems.
>     I wonder if it's possible to make email unique and
>     first_name,last_name
>     unique_together by using this technique.
>
>     This:
>
>     User._meta.get_field('email').unique = True
>     fails with  AttributeError: can't set attribute.
>
>     I know I can enforce uniqueness in forms but it would be nice if this
>     can be done by modifying the User class and have the database field be
>     unique because the same database may need to be accessed from
>     outside of
>     a django project.
>
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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