Re: Problems width add_to_class

2009-11-05 Thread Matt Schinckel

On Nov 6, 7:34 am, Sandra Django  wrote:
> Hi friends, I have a problem. I'm trying to add to User class of Django an
> attribute. For that I'm using add_to_class method. I did the following:
>
>    1. Delete from Data Base the tables: «auth_user», «auth_user_groups» y
>    «auth_user_user_permissions».
>    2. In models.py of «main» aplication I put the following:
>
>    from django.contrib.auth.models import User
>    User.add_to_class('new_attribute', models.CharField(max_length = 150))
>
>    3. I did syncdb and the tables that I had deleted before were created
>    again
>    4. When I go to Data Base, appears in the table «auth_user» the
>    «new_attribute» field, however, not in users form of Django
>

You will probably want to either subclass the UserForm, or the admin
template.

The User form is different to generic model forms.  I would suggest
you look at the django.contrib.admin files that deal with this
particular form.

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



Problems width add_to_class

2009-11-05 Thread Sandra Django
Hi friends, I have a problem. I'm trying to add to User class of Django an
attribute. For that I'm using add_to_class method. I did the following:

   1. Delete from Data Base the tables: «auth_user», «auth_user_groups» y
   «auth_user_user_permissions».
   2. In models.py of «main» aplication I put the following:

   from django.contrib.auth.models import User
   User.add_to_class('new_attribute', models.CharField(max_length = 150))

   3. I did syncdb and the tables that I had deleted before were created
   again
   4. When I go to Data Base, appears in the table «auth_user» the
   «new_attribute» field, however, not in users form of Django

Why? I don't understand. What am I doing bad or what more I need to do?
Thanks

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