diff --git a/tests/postgres_tests/migrations/0002_create_test_models.py b/tests/postgres_tests/migrations/0002_create_test_models.py
index 106818a..da35c90 100644
|
a
|
b
|
class Migration(migrations.Migration):
|
| 49 | 49 | bases=(models.Model,), |
| 50 | 50 | ), |
| 51 | 51 | migrations.CreateModel( |
| | 52 | name='FKToHStoreModel', |
| | 53 | fields=[ |
| | 54 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
| | 55 | ('fk', models.ForeignKey('postgres_tests.HStoreModel')), |
| | 56 | ], |
| | 57 | options={ |
| | 58 | 'required_db_vendor': 'postgresql', |
| | 59 | }, |
| | 60 | bases=(models.Model,), |
| | 61 | ), |
| | 62 | migrations.CreateModel( |
| 52 | 63 | name='OtherTypesArrayModel', |
| 53 | 64 | fields=[ |
| 54 | 65 | ('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 aafd529..cc3a2fd 100644
|
a
|
b
|
class HStoreModel(PostgreSQLModel):
|
| 44 | 44 | field = HStoreField(blank=True, null=True) |
| 45 | 45 | |
| 46 | 46 | |
| | 47 | class FKToHStoreModel(models.Model): |
| | 48 | fk = models.ForeignKey(HStoreModel) |
| | 49 | |
| | 50 | |
| 47 | 51 | class CharFieldModel(models.Model): |
| 48 | 52 | field = models.CharField(max_length=16) |
| 49 | 53 | |
diff --git a/tests/postgres_tests/test_hstore.py b/tests/postgres_tests/test_hstore.py
index ed88e2f..98902b4 100644
|
a
|
b
|
class TestQuerying(PostgresSQLTestCase):
|
| 114 | 114 | self.objs[:3] |
| 115 | 115 | ) |
| 116 | 116 | |
| | 117 | def test_fk_filter(self): |
| | 118 | from .models import FKToHStoreModel |
| | 119 | obj = FKToHStoreModel.objects.create(fk=self.objs[0]) |
| | 120 | subquery = HStoreModel.objects.filter(field__a='b') |
| | 121 | # test passes with `list(subquery)` below. |
| | 122 | self.assertSequenceEqual( |
| | 123 | FKToHStoreModel.objects.filter(fk__in=subquery), |
| | 124 | [obj] |
| | 125 | ) |
| | 126 | |
| 117 | 127 | |
| 118 | 128 | class TestSerialization(PostgresSQLTestCase): |
| 119 | 129 | test_data = '[{"fields": {"field": "{\\"a\\": \\"b\\"}"}, "model": "postgres_tests.hstoremodel", "pk": null}]' |