[Python] How do I clone a Django model instance object and save it to the database?

Discussão em 'Python' iniciado por Stack, Janeiro 15, 2025.

  1. Stack

    Stack Membro Participativo

    Foo.objects.get(pk="foo")
    <Foo: test>


    In the database, I want to add another object which is a copy of the object above.

    Suppose my table has one row. I want to insert the first row object into another row with a different primary key. How can I do that?

    Continue reading...

Compartilhe esta Página