Hi everyone, as the title says i have a problem when trying to copy a model 
instance.

Basically when i try in my tests to duplicate an object by setting its pk 
and id to None, i get nothing in return.

class MyTest(TestCase):
    def setUp(self):
        u1 = User(username='user1', email='te...@test.com')
        u1.save()
        a1 = Account(full_name='Test1', user=u1)
        a1.save()

    def test_copy(self):
        account1 = Account.objects.all()[0]
        account1.pk = None
        account1.id = None
        account1.save()
        print Account.objects.all()

>>>... <Account: user1>

Am i wrong in thinking i should be getting 2 objects after setting the pk 
to none?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c7b353bc-f4aa-4c4d-920d-408650c07d02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to