mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #33187 -- Made inspectdb handle ForeignKey.to_field attribute.
This commit is contained in:
parent
dab48b7482
commit
aaf9b55858
3 changed files with 22 additions and 2 deletions
|
@ -204,6 +204,16 @@ class InspectDBTestCase(TestCase):
|
|||
output,
|
||||
)
|
||||
|
||||
@skipUnlessDBFeature('can_introspect_foreign_keys')
|
||||
def test_foreign_key_to_field(self):
|
||||
out = StringIO()
|
||||
call_command('inspectdb', 'inspectdb_foreignkeytofield', stdout=out)
|
||||
self.assertIn(
|
||||
"to_field_fk = models.ForeignKey('InspectdbPeoplemoredata', "
|
||||
"models.DO_NOTHING, to_field='people_unique_id')",
|
||||
out.getvalue(),
|
||||
)
|
||||
|
||||
def test_digits_column_name_introspection(self):
|
||||
"""Introspection of column names consist/start with digits (#16536/#17676)"""
|
||||
char_field_type = connection.features.introspected_field_types['CharField']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue