mirror of
https://github.com/django/django.git
synced 2025-08-31 15:57:45 +00:00
Fixed #29391 -- Made PostgresSimpleLookup respect Field.get_db_prep_value().
This commit is contained in:
parent
c492fdfd24
commit
5a36c81f58
5 changed files with 42 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue