Found My mistake, create parent_link: class Employee(User): user = models.OneToOneField(User, parent_link=True) address = models.CharField(max_length=50, null=True, blank=True) phone1 = models.CharField(max_length=15, null=True, blank=True) phone2 = models.CharField(max_length=15, null=True, blank=True) skype = models.CharField(max_length=32, null=True, blank=True) website = models.URLField(null=True, blank=True) comments = models.TextField(null=True, blank=True)
Here is my signal: def user_post_save(sender, instance, **kwargs): Employee.objects.get_or_create(user=instance) models.signals.post_save.connect(user_post_save, sender=User) Now i get IntegrityError at /admin/auth/user/add/ column username is not unique On Sep 13, 3:12 pm, Dmitry Gladkov <dmitry.glad...@gmail.com> wrote: > Hi! > > I've got user profile, that uses multi-table inheritance: > > class Employee(User): > address = models.CharField(max_length=50, null=True, blank=True) > phone1 = models.CharField(max_length=15, null=True, blank=True) > phone2 = models.CharField(max_length=15, null=True, blank=True) > skype = models.CharField(max_length=32, null=True, blank=True) > website = models.URLField(null=True, blank=True) > comments = models.TextField(null=True, blank=True) > > When I create a new employee from django admin interface it creates a > new user for it, but how to manage to create a new blank employee > profile after creating a new user from django admin? > > I tried to use post_save signal for it, but have no idea how to create > a new employee when it's inherited from known user. > When i use "instance.employee" it says "Employee matching query does > not exist." > When i try to create new employee using Employee(user=instance).save() > it says that there's no field called "user". > 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 -~----------~----~----~----~------~----~------~--~---