I have to define a function in order to duplicate an instance of my class Scenario.

I created an identical instance whose fields are identical except `name` and `id`, but when I save the new instance the original is deleted. Here is the code of the function:

```
def duplicate(scn):
attr_list = [field for field in Scenario._meta.get_fields() if isinstance(field,django.db.models.fields.Field)]
s = Scenario()
s.id = str(scn.id+10)
s.name='s_dup_of_' + scn.name
#print(Scenario.objects.all())
for a in attr_list:
    if a.name!='name' and a.name!= 'id':
        value = getattr(scn,a.name)
        setattr(s,a.name,value)
#print(Scenario.objects.all())

#list_class = [Unit,HidroUnit,ThermalUnit,Arc,Flow,Fuel,Group,Loop,Machine,ModeVir,Node,Region,Reservoir,Solution,Station,Transitions,Tube]
list_class = [Unit,HidroUnit,ThermalUnit]
for myClass in list_class:
    instance_list = myClass.objects.filter(scenario=scn)
    attr_list = [field for field in myClass._meta.get_fields() if isinstance(field,django.db.models.fields.Field)]

    for instance in instance_list:
        inst_new = myClass()
        for a in attr_list:
            if a.name!='temporalobject_ptr':
                value = getattr(instance,a.name)
                setattr(inst_new,a.name,value)
        inst_new.save()

#print(Scenario.objects.all())
s.save()
#print(Scenario.objects.all())
return None

```

For example, if I want to duplicate the scenario called `s1` and to create the scenario `s_dup_s1`, and if I reproduce all lines of my duplicate function, then after I write `s_dup_s1.save()` the old instance `s1` is deleted.

What can I do if I want `s1` and `s1_sup_s1` at the same time?
This is what happens when I run the code:
[![enter image description here](https://i.stack.imgur.com/QtCx9.png)](https://i.stack.imgur.com/QtCx9.png)

This doesn't work either:
[![enter image description here](https://i.stack.imgur.com/Racd4.png)](https://i.stack.imgur.com/Racd4.png)