Friday, June 17, 2011

contribute_to_class and the admin site

Hey guys,

I want to find an easy way to expand fields in the User model. I'm not
quite understanding the tutorial where I need to create a model from a
new app. I heard that there is a function called contribute_to_class.
This is what my model.py file looks like:

from django.db import models
from django.contrib.auth.models import User

skype_field = models.CharField(max_length=32)
skype_field.contribute_to_class(User, 'skype_field')

The problem is that my admin site doesn't show these changes and I
don't know why. Is this file even doing anything? When I run the
sqlall over the app, nothing shows up, so I feel like nothing is
happening.
Also, if I were to now create an object and set its skype field, would
it be something like:

u = User.object.create...
u.skype_field = "blah"

Thank you.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate