On Jul 11, 11:15 am, NISA BALAKRISHNAN <snisa.balakrish...@gmail.com>
wrote:
> I am new to django.
> I am trying to write a model that looks like dis.
>
> class Profile(models.Model):
>     user = models.OneToOneField(User)
>     birth_date = models.DateField()
>     bio = models.TextField()
>     address = models.CharField(max_length=100)
>     city = models.CharField(max_length=50)
>     state = models.CharField(max_length=50)
>
>     def create_user_profile(sender, instance, created, **kwargs):
>      if created:
>         Profile.objects.create(user=instance)
>
>     post_save.connect(create_user_profile, sender=User)

OT, but the part starting from "def create_user_profile" should live
outside the class statement.

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