mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Complete rework of translating data values from database Deprecation of SubfieldBase, removal of resolve_columns and convert_values in favour of a more general converter based approach and public API Field.from_db_value(). Now works seamlessly with aggregation, .values() and raw queries. Thanks to akaariai in particular for extensive advice and inspiration, also to shaib, manfre and timograham for their reviews.
This commit is contained in:
parent
89559bcfb0
commit
e9103402c0
35 changed files with 443 additions and 521 deletions
|
@ -20,8 +20,6 @@ from django.db.backends.signals import connection_created
|
|||
from django.db.backends.postgresql_psycopg2 import version as pg_version
|
||||
from django.db.backends.utils import format_number, CursorWrapper
|
||||
from django.db.models import Sum, Avg, Variance, StdDev
|
||||
from django.db.models.fields import (AutoField, DateField, DateTimeField,
|
||||
DecimalField, IntegerField, TimeField)
|
||||
from django.db.models.sql.constants import CURSOR
|
||||
from django.db.utils import ConnectionHandler
|
||||
from django.test import (TestCase, TransactionTestCase, override_settings,
|
||||
|
@ -133,16 +131,6 @@ class SQLiteTests(TestCase):
|
|||
self.assertRaises(NotImplementedError,
|
||||
models.Item.objects.all().aggregate, aggregate('last_modified'))
|
||||
|
||||
def test_convert_values_to_handle_null_value(self):
|
||||
from django.db.backends.sqlite3.base import DatabaseOperations
|
||||
convert_values = DatabaseOperations(connection).convert_values
|
||||
self.assertIsNone(convert_values(None, AutoField(primary_key=True)))
|
||||
self.assertIsNone(convert_values(None, DateField()))
|
||||
self.assertIsNone(convert_values(None, DateTimeField()))
|
||||
self.assertIsNone(convert_values(None, DecimalField()))
|
||||
self.assertIsNone(convert_values(None, IntegerField()))
|
||||
self.assertIsNone(convert_values(None, TimeField()))
|
||||
|
||||
|
||||
@unittest.skipUnless(connection.vendor == 'postgresql', "Test only for PostgreSQL")
|
||||
class PostgreSQLTests(TestCase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue