diff --git a/tests/postgres_tests/migrations/0002_create_test_models.py b/tests/postgres_tests/migrations/0002_create_test_models.py
index 1cb6fe6..4fbe68b 100644
a
|
b
|
class Migration(migrations.Migration):
|
150 | 150 | bases=None, |
151 | 151 | ), |
152 | 152 | migrations.CreateModel( |
| 153 | name='CITestModel2', |
| 154 | fields=[ |
| 155 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
| 156 | ('name', CICharField(max_length=255, unique=True)), |
| 157 | ], |
| 158 | options={ |
| 159 | 'required_db_vendor': 'postgresql', |
| 160 | }, |
| 161 | bases=None, |
| 162 | ), |
| 163 | migrations.CreateModel( |
153 | 164 | name='Line', |
154 | 165 | fields=[ |
155 | 166 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
diff --git a/tests/postgres_tests/models.py b/tests/postgres_tests/models.py
index fcfd85f..e7df73f 100644
a
|
b
|
class CITestModel(PostgreSQLModel):
|
112 | 112 | return self.name |
113 | 113 | |
114 | 114 | |
| 115 | class CITestModel2(PostgreSQLModel): |
| 116 | name = CICharField(max_length=255, unique=True) |
| 117 | |
| 118 | def __str__(self): |
| 119 | return self.name |
| 120 | |
| 121 | |
115 | 122 | class Line(PostgreSQLModel): |
116 | 123 | scene = models.ForeignKey('Scene', models.CASCADE) |
117 | 124 | character = models.ForeignKey('Character', models.CASCADE) |
diff --git a/tests/postgres_tests/test_citext.py b/tests/postgres_tests/test_citext.py
index 0a7012b..f4ec8d7 100644
a
|
b
|
modifiers to enforce use of an index.
|
5 | 5 | """ |
6 | 6 | from django.db import IntegrityError |
7 | 7 | from django.test.utils import modify_settings |
| 8 | from django.forms.models import modelformset_factory |
8 | 9 | |
9 | 10 | from . import PostgreSQLTestCase |
10 | | from .models import CITestModel |
| 11 | from .models import CITestModel, CITestModel2 |
11 | 12 | |
12 | 13 | |
13 | 14 | @modify_settings(INSTALLED_APPS={'append': 'django.contrib.postgres'}) |
… |
… |
class CITextTestCase(PostgreSQLTestCase):
|
42 | 43 | instance = CITestModel.objects.get() |
43 | 44 | self.assertEqual(instance.array_field, self.john.array_field) |
44 | 45 | self.assertTrue(CITestModel.objects.filter(array_field__contains=['joe']).exists()) |
| 46 | |
| 47 | def test_duplicate_formset_mixed_case(self): |
| 48 | FormSet = modelformset_factory(CITestModel2, extra=2, fields=['name']) |
| 49 | data = { |
| 50 | 'form-TOTAL_FORMS': 2, |
| 51 | 'form-INITIAL_FORMS': 0, |
| 52 | 'form-0-name': 'frank', |
| 53 | 'form-1-name': 'FRANK', |
| 54 | } |
| 55 | formset = FormSet(data) |
| 56 | self.assertEquals( |
| 57 | formset.non_form_errors(), |
| 58 | ['Please correct the duplicate data for name.'], |
| 59 | ) |
| 60 | self.assertEquals( |
| 61 | formset.errors, |
| 62 | [{}, {'__all__': ['Please correct the duplicate values below.']}], |
| 63 | ) |