Hello again,

well i am stupid:
the code above works,null=True should work
but when changin the model a simple "manage.py syncdb"
is sometimes not enough as it does not alter created tables
so i "manage.py reset" the whole thing and that's it...

sorry for the spam
kalinsko

On Jun 2, 8:34 pm, kalinski <kalin...@amei.se> wrote:
> Hi Djangos,
>
> i am attaching a UserProfile to my Users
> by using a post_save signal:
>
> class UserProfile(models.Model):
>     user = models.ForeignKey(User, unique=True)
>     address = models.ForeignKey(Address, blank=True, null=True)
>
> def user_post_save(sender, instance, signal, *args, **kwargs):
>     profile =
> UserProfile.objects.get_or_create(user=instance,address=None)
>
> now when the User is created he doesn't need an address,
> as we gather this info later, but even with null=True or blank=True
> i will get:
>
> IntegrityError at /admin/auth/user/add/
> orderbook_userprofile.address_id may not be NULL
>
> is there another way of creating UserProfiles this way without having
> to
> fill them with infos already?
>
> mange tak
> kalinski

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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