mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
Fixed #22001 -- Ensure db_type is respected.
db_parameters should respect an already existing db_type method and return that as its type string. In particular, this was causing some fields from gis to not be generated. Thanks to @bigsassy and @blueyed for their work on the patch. Also fixed #22260
This commit is contained in:
parent
37f7f233f5
commit
d22b291890
8 changed files with 105 additions and 15 deletions
|
@ -3,9 +3,10 @@ from __future__ import unicode_literals
|
|||
import inspect
|
||||
|
||||
from django.core import serializers
|
||||
from django.db import connection
|
||||
from django.test import TestCase
|
||||
|
||||
from .fields import Small
|
||||
from .fields import Small, CustomTypedField
|
||||
from .models import DataModel, MyModel, OtherModel
|
||||
|
||||
|
||||
|
@ -104,3 +105,10 @@ class CustomField(TestCase):
|
|||
data = dict(inspect.getmembers(MyModel))
|
||||
self.assertIn('__module__', data)
|
||||
self.assertEqual(data['__module__'], 'field_subclassing.models')
|
||||
|
||||
|
||||
class TestDbType(TestCase):
|
||||
|
||||
def test_db_parameters_respects_db_type(self):
|
||||
f = CustomTypedField()
|
||||
self.assertEqual(f.db_parameters(connection)['type'], 'custom_field')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue