1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #8317 -- Corrected the inspectdb management command to properly set primary_key=True and unique=True on foreign keys. Thanks to bthomas for the report and patch, and to David Gouldin for the tests.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17451 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Julien Phalip
2012-02-05 07:51:37 +00:00
parent d02ba7f4ee
commit ad8ebb7006
3 changed files with 23 additions and 10 deletions

View File

@@ -13,4 +13,8 @@ class InspectDBTestCase(TestCase):
error_message = "inspectdb generated an attribute name which is a python keyword"
self.assertNotIn("from = models.ForeignKey(InspectdbPeople)", out.getvalue(), msg=error_message)
self.assertIn("from_field = models.ForeignKey(InspectdbPeople)", out.getvalue())
self.assertIn("people_pk = models.ForeignKey(InspectdbPeople, primary_key=True)",
out.getvalue())
self.assertIn("people_unique = models.ForeignKey(InspectdbPeople, unique=True)",
out.getvalue())
out.close()