Code

Ticket #2259: pk_change.diff

File pk_change.diff, 685 bytes (added by pigletto, 7 years ago)
Line 
1Index: tests/modeltests/basic/models.py
2===================================================================
3--- tests/modeltests/basic/models.py    (wersja 6231)
4+++ tests/modeltests/basic/models.py    (kopia robocza)
5@@ -384,4 +384,15 @@
6 >>> a.save()
7 >>> Article.objects.get(pk=a.id).headline
8 u'\u6797\u539f \u3081\u3050\u307f'
9+
10+# It is possible to change primary key value
11+>>> bc = Article(headline="primary changed article", pub_date=datetime(2008, 1, 1))
12+>>> bc.save()
13+>>> total = Article.objects.all().count()
14+
15+# After changing primary key value we still have same number of objects
16+>>> bc.id = 999
17+>>> bc.save()
18+>>> print total == Article.objects.all().count()
19+True
20 """