mirror of https://github.com/django/django.git
Refs #17917 -- Added a test for pickling annotations on fields with callable defaults.
Fixed in f403653cf1
.
This commit is contained in:
parent
9a6fc9606c
commit
ca43ee9d0f
|
@ -5,6 +5,7 @@ import pickle
|
|||
import unittest
|
||||
import warnings
|
||||
|
||||
from django.db import models
|
||||
from django.test import TestCase
|
||||
from django.utils import six
|
||||
from django.utils.encoding import force_text
|
||||
|
@ -130,6 +131,11 @@ class PickleabilityTestCase(TestCase):
|
|||
m2ms = pickle.loads(pickle.dumps(m2ms))
|
||||
self.assertQuerysetEqual(m2ms, [m2m], lambda x: x)
|
||||
|
||||
def test_annotation_with_callable_default(self):
|
||||
# Happening.when has a callable default of datetime.datetime.now.
|
||||
qs = Happening.objects.annotate(latest_time=models.Max('when'))
|
||||
self.assert_pickles(qs)
|
||||
|
||||
def test_missing_django_version_unpickling(self):
|
||||
"""
|
||||
#21430 -- Verifies a warning is raised for querysets that are
|
||||
|
|
Loading…
Reference in New Issue