mirror of
https://github.com/django/django.git
synced 2025-11-20 03:30:00 +00:00
Fixed #3790 -- Fixed a problem with sequence resetting during fixture loads when using Postgres. Thanks to Jon Ballard and scott@staplefish.com for the report, and to Zach Thompson for suggesting a solution.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4937 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e339a41222
commit
dabd96646c
14 changed files with 121 additions and 26 deletions
0
tests/regressiontests/fixtures_regress/__init__.py
Normal file
0
tests/regressiontests/fixtures_regress/__init__.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[
|
||||
{
|
||||
"pk": "1",
|
||||
"model": "fixtures_regress.animal",
|
||||
"fields": {
|
||||
"name": "Lion",
|
||||
"latin_name": "Panthera leo"
|
||||
}
|
||||
}
|
||||
]
|
||||
22
tests/regressiontests/fixtures_regress/models.py
Normal file
22
tests/regressiontests/fixtures_regress/models.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
from django.db import models
|
||||
|
||||
class Animal(models.Model):
|
||||
name = models.CharField(maxlength=150)
|
||||
latin_name = models.CharField(maxlength=150)
|
||||
|
||||
def __str__(self):
|
||||
return self.common_name
|
||||
|
||||
__test__ = {'API_TESTS':"""
|
||||
>>> from django.core import management
|
||||
|
||||
# Load a fixture that uses PK=1
|
||||
>>> management.load_data(['sequence'], verbosity=0)
|
||||
|
||||
# Create a new animal. Without a sequence reset, this new object
|
||||
# will take a PK of 1 (on Postgres), and the save will fail.
|
||||
# This is a regression test for ticket #3790.
|
||||
>>> animal = Animal(name='Platypus', latin_name='Ornithorhynchus anatinus')
|
||||
>>> animal.save()
|
||||
|
||||
"""}
|
||||
Loading…
Add table
Add a link
Reference in a new issue