Hello Jon, have you ever found a solution for this? Thanks.
On Tuesday, June 14, 2011 5:04:09 PM UTC+2, Jon Biddle wrote: > > The issue seems to come from the fact that the order of operations > when you create the user looks like this: > > 1) Django admin saves the new User > 2) post_save on User is triggered, and User's profile is created > 3) Django admin saves the UserProfile... but it already exists, and an > integrity error is raised > > > I'm currently looking into a solution to this as well, and will let > you know what I find. > > On May 26, 8:39 am, Malcolm Box <malcolm....@gmail.com> wrote: > > On 26 May 2011 10:23, Jani Tiainen <rede...@gmail.com> wrote: > > > > > If I extend auth.User with custom profile and add automatic profile > > > creation signal it works as expected. > > > > > But if I try to add admin inline editor for profile when saving I get > > > exception about integration violation. > > > > > It happens because admin tries to create second profile for user when > > > saving. > > > > Have your signal handler check whether this is a creation of a user or > an > > edit. Only create the profile in the first case. > > > > You may also need to check whether the profile already exists before > trying > > to create - get_or_create() is your friend here. > > > > Malcolm -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/By34T_tvqpsJ. 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.