diff options
author | Simon Charette <charette.s@gmail.com> | 2017-08-08 13:31:59 -0400 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2017-09-11 12:22:39 -0400 |
commit | 08654a99bbdd09049d682ae57cc94241534b29f0 (patch) | |
tree | d8c4ab1142e2bbe7a11c002230c16630c88c6087 /django/contrib/postgres/functions.py | |
parent | 13be45308045f522dfd1d0ff3da3cdc163bc521d (diff) | |
download | django-08654a99bbdd09049d682ae57cc94241534b29f0.tar.gz |
Fixed #28492 -- Defined default output_field of expressions at the class level.
This wasn't possible when settings were accessed during Field initialization
time as our test suite setup script was triggering imports of expressions
before settings were configured.
Diffstat (limited to 'django/contrib/postgres/functions.py')
-rw-r--r-- | django/contrib/postgres/functions.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/django/contrib/postgres/functions.py b/django/contrib/postgres/functions.py index 36b32e0751..819ce058e5 100644 --- a/django/contrib/postgres/functions.py +++ b/django/contrib/postgres/functions.py @@ -3,17 +3,9 @@ from django.db.models import DateTimeField, Func, UUIDField class RandomUUID(Func): template = 'GEN_RANDOM_UUID()' - - def __init__(self, output_field=None, **extra): - if output_field is None: - output_field = UUIDField() - super().__init__(output_field=output_field, **extra) + output_field = UUIDField() class TransactionNow(Func): template = 'CURRENT_TIMESTAMP' - - def __init__(self, output_field=None, **extra): - if output_field is None: - output_field = DateTimeField() - super().__init__(output_field=output_field, **extra) + output_field = DateTimeField() |