1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #29391 -- Made PostgresSimpleLookup respect Field.get_db_prep_value().

This commit is contained in:
Vinay Karanam
2019-02-04 04:57:19 +05:30
committed by Tim Graham
parent c492fdfd24
commit 5a36c81f58
5 changed files with 42 additions and 9 deletions

View File

@@ -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