Copy all fields of a django model instance

Peter picture Peter · Sep 30, 2010 · Viewed 10k times · Source

ok i think this is very basic, but since I am new to Django I don't know how to handle this.

I need to copy an instance of a django-model. As explained here, there is a problem with copying ManyToMany relations. But the attachment "django-model-copying.diff" has that function I guess. So I don't know - does my Django already have that function? I don't know how to call it. Help would be appreciated.

Answer

Aidan Ewen picture Aidan Ewen · Mar 10, 2013

The docs include directions on how to do this - including how to handle many to many relationships.