mirror of
				https://github.com/django/django.git
				synced 2025-10-30 09:06:13 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -3,7 +3,6 @@ Helper functions for creating Form classes from Django models | |||||||
| and database field objects. | and database field objects. | ||||||
| """ | """ | ||||||
|  |  | ||||||
| from django.db import connections |  | ||||||
| from django.utils.encoding import smart_unicode, force_unicode | from django.utils.encoding import smart_unicode, force_unicode | ||||||
| from django.utils.datastructures import SortedDict | from django.utils.datastructures import SortedDict | ||||||
| from django.utils.text import get_text_list, capfirst | from django.utils.text import get_text_list, capfirst | ||||||
| @@ -428,6 +427,9 @@ class BaseModelFormSet(BaseFormSet): | |||||||
|  |  | ||||||
|     def _construct_form(self, i, **kwargs): |     def _construct_form(self, i, **kwargs): | ||||||
|         if self.is_bound and i < self.initial_form_count(): |         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_key = "%s-%s" % (self.add_prefix(i), self.model._meta.pk.name) | ||||||
|             pk = self.data[pk_key] |             pk = self.data[pk_key] | ||||||
|             pk_field = self.model._meta.pk |             pk_field = self.model._meta.pk | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user