Saturday, September 25, 2010

Extending Profile with a ForeignKey field

Hi,
I want to add a ForeignKey field in UserProfile. Sth like this:

****

from myapp.models import Person
class Profile(models.Model):

user = models.ForeignKey(User, unique=True,
verbose_name=_('user'))
name = models.CharField(_('name'), max_length=50, null=True,
blank=True)
about = models.TextField(_('about'), null=True, blank=True)
location = models.CharField(_('location'), max_length=40,
null=True, blank=True)
website = models.URLField(_('website'), null=True, blank=True,
verify_exists=False)
person = models.ForeignKey(Person, unique=True,
vervose_name=_('person'))

****

But in Signup form, I got this error:
IntegrityError
profiles_profile.person_id may not be NULL

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

No comments:

Post a Comment