On 11/2/06, ZebZiggle <[EMAIL PROTECTED]> wrote:
>
> Wow ... I had no idea about that. I must have a ton of duplicate
> records in production now. (more homework).
>
> What's the correct way to set a related object to null?

By assignment, just as you would with any other attribute (i.e.,
instance.attribute = None). This requires that the ForeignKey in
question has null=True - if it isn't you will get errors when you try
to save.

The case you gave was setting a primary key (the ID field of User),
not a related object. If you clear the primary key and save an object,
a new db record will be created. If you set a related object to None,
that relation will be cleared (if allowed), but no additional object
will be created.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to