diff options
| author | Vinay Karanam <vinayinvicible@gmail.com> | 2019-02-04 04:57:19 +0530 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2019-02-09 18:05:50 -0500 |
| commit | 5a36c81f58b8ff45d8dac052343722c54e3fa521 (patch) | |
| tree | c6e2c9d897354e0f30129a8eb19aa18b8d053679 /tests/postgres_tests/fields.py | |
| parent | c492fdfd240f10ade5aa11938fc87f903ef85890 (diff) | |
Fixed #29391 -- Made PostgresSimpleLookup respect Field.get_db_prep_value().
Diffstat (limited to 'tests/postgres_tests/fields.py')
| -rw-r--r-- | tests/postgres_tests/fields.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/postgres_tests/fields.py b/tests/postgres_tests/fields.py index 2275eb2ab2..4ebc0ce7dc 100644 --- a/tests/postgres_tests/fields.py +++ b/tests/postgres_tests/fields.py @@ -2,6 +2,8 @@ Indirection layer for PostgreSQL-specific fields, so the tests don't fail when run with a backend other than PostgreSQL. """ +import enum + from django.db import models try: @@ -40,3 +42,8 @@ except ImportError: IntegerRangeField = models.Field JSONField = DummyJSONField SearchVectorField = models.Field + + +class EnumField(models.CharField): + def get_prep_value(self, value): + return value.value if isinstance(value, enum.Enum) else value |
