summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2011-03-14 04:42:04 +0000
committerAdrian Holovaty <adrian@holovaty.com>2011-03-14 04:42:04 +0000
commit3a5b87cf6d9965b90ab744ee328e816ecc9855b7 (patch)
tree2ec8e047a2ca25aed2662d63c1a459e328083492
parente2627d267d8b98c7466d2c149b58cc406a3a6599 (diff)
Importing django.forms no longer requires DJANGO_SETTINGS_MODULE. Moved django.db.connections import in django.forms.models to the method where it's used.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15797 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/forms/models.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index 1356c9f517..8a48e155df 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -3,7 +3,6 @@ Helper functions for creating Form classes from Django models
and database field objects.
"""
-from django.db import connections
from django.utils.encoding import smart_unicode, force_unicode
from django.utils.datastructures import SortedDict
from django.utils.text import get_text_list, capfirst
@@ -428,6 +427,9 @@ class BaseModelFormSet(BaseFormSet):
def _construct_form(self, i, **kwargs):
if self.is_bound and i < self.initial_form_count():
+ # Import goes here instead of module-level because importing
+ # django.db has side effects.
+ from django.db import connections
pk_key = "%s-%s" % (self.add_prefix(i), self.model._meta.pk.name)
pk = self.data[pk_key]
pk_field = self.model._meta.pk