Hi Dave --

I'm not sure what's going on in your code example, but there's a
*much* easier way of copying an object::

    >>> o = MyModel.objects.get(pk=1)
    >>> o.id = None
    >>> o.save()

By setting the ID (or whatever your primary key is called) to ``None``
and calling save() you'll force Django to insert a new object instead
of updating the existing one. All that monkeying with ``__dict__``
isn't really needed.

/me makes note to think about adding an ``obj.copy()`` method...

Jacob

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to