diff --git a/django/contrib/localflavor/us/forms.py b/django/contrib/localflavor/us/forms.py
index 36d7645027..0a79c40a47 100644
--- a/django/contrib/localflavor/us/forms.py
+++ b/django/contrib/localflavor/us/forms.py
@@ -2,12 +2,16 @@
USA-specific Form helpers
"""
+from __future__ import absolute_import
+
+import re
+
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select, CharField
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
-import re
+
phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$')
ssn_re = re.compile(r"^(?P\d{3})[-\ ]?(?P\d{2})[-\ ]?(?P\d{4})$")
@@ -89,7 +93,7 @@ class USStateField(Field):
}
def clean(self, value):
- from us_states import STATES_NORMALIZED
+ from django.contrib.localflavor.us.us_states import STATES_NORMALIZED
super(USStateField, self).clean(value)
if value in EMPTY_VALUES:
return u''
@@ -109,7 +113,7 @@ class USStateSelect(Select):
A Select widget that uses a list of U.S. states/territories as its choices.
"""
def __init__(self, attrs=None):
- from us_states import STATE_CHOICES
+ from django.contrib.localflavor.us.us_states import STATE_CHOICES
super(USStateSelect, self).__init__(attrs, choices=STATE_CHOICES)
class USPSSelect(Select):
@@ -118,5 +122,5 @@ class USPSSelect(Select):
choices.
"""
def __init__(self, attrs=None):
- from us_states import USPS_CHOICES
+ from django.contrib.localflavor.us.us_states import USPS_CHOICES
super(USPSSelect, self).__init__(attrs, choices=USPS_CHOICES)
diff --git a/django/contrib/localflavor/uy/forms.py b/django/contrib/localflavor/uy/forms.py
index 2d90e52ce6..211216222d 100644
--- a/django/contrib/localflavor/uy/forms.py
+++ b/django/contrib/localflavor/uy/forms.py
@@ -2,6 +2,9 @@
"""
UY-specific form helpers.
"""
+
+from __future__ import absolute_import
+
from django.core.validators import EMPTY_VALUES
from django.forms.fields import Select, RegexField
from django.forms import ValidationError
@@ -14,7 +17,7 @@ class UYDepartamentSelect(Select):
A Select widget that uses a list of Uruguayan departaments as its choices.
"""
def __init__(self, attrs=None):
- from uy_departaments import DEPARTAMENT_CHOICES
+ from django.contrib.localflavor.uy.uy_departaments import DEPARTAMENT_CHOICES
super(UYDepartamentSelect, self).__init__(attrs, choices=DEPARTAMENT_CHOICES)
diff --git a/django/db/models/sql/__init__.py b/django/db/models/sql/__init__.py
index 7310982690..c07f2b7b23 100644
--- a/django/db/models/sql/__init__.py
+++ b/django/db/models/sql/__init__.py
@@ -1,7 +1,7 @@
from query import *
from subqueries import *
-from where import AND, OR
-from datastructures import EmptyResultSet
+from django.db.models.sql.datastructures import EmptyResultSet
+from django.db.models.sql.where import AND, OR
__all__ = ['Query', 'AND', 'OR', 'EmptyResultSet']
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py
index 3e9dbf0527..1455ba6e18 100644
--- a/django/db/models/sql/where.py
+++ b/django/db/models/sql/where.py
@@ -1,12 +1,15 @@
"""
Code to manage the creation and SQL rendering of 'where' constraints.
"""
+
+from __future__ import absolute_import
+
import datetime
from itertools import repeat
from django.utils import tree
from django.db.models.fields import Field
-from datastructures import EmptyResultSet, FullResultSet
+from django.db.models.sql.datastructures import EmptyResultSet, FullResultSet
# Connection types
AND = 'AND'
diff --git a/django/forms/fields.py b/django/forms/fields.py
index ab83b8b411..8e727b4abb 100644
--- a/django/forms/fields.py
+++ b/django/forms/fields.py
@@ -2,6 +2,8 @@
Field classes.
"""
+from __future__ import absolute_import
+
import copy
import datetime
import os
@@ -13,21 +15,21 @@ try:
except ImportError:
from StringIO import StringIO
-from django.core.exceptions import ValidationError
from django.core import validators
+from django.core.exceptions import ValidationError
+from django.forms.util import ErrorList
+from django.forms.widgets import (TextInput, PasswordInput, HiddenInput,
+ MultipleHiddenInput, ClearableFileInput, CheckboxInput, Select,
+ NullBooleanSelect, SelectMultiple, DateInput, DateTimeInput, TimeInput,
+ SplitDateTimeWidget, SplitHiddenDateTimeWidget, FILE_INPUT_CONTRADICTION)
from django.utils import formats
-from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode, smart_str, force_unicode
from django.utils.ipv6 import clean_ipv6_address
+from django.utils.translation import ugettext_lazy as _
# Provide this import for backwards compatibility.
from django.core.validators import EMPTY_VALUES
-from util import ErrorList
-from widgets import (TextInput, PasswordInput, HiddenInput,
- MultipleHiddenInput, ClearableFileInput, CheckboxInput, Select,
- NullBooleanSelect, SelectMultiple, DateInput, DateTimeInput, TimeInput,
- SplitDateTimeWidget, SplitHiddenDateTimeWidget, FILE_INPUT_CONTRADICTION)
__all__ = (
'Field', 'CharField', 'IntegerField',
diff --git a/django/forms/models.py b/django/forms/models.py
index 254cca3db8..b65f067846 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -3,20 +3,21 @@ Helper functions for creating Form classes from Django models
and database field objects.
"""
+from __future__ import absolute_import
+
from django.core.exceptions import ValidationError, NON_FIELD_ERRORS, FieldError
from django.core.validators import EMPTY_VALUES
-
+from django.forms.fields import Field, ChoiceField
+from django.forms.forms import BaseForm, get_declared_fields
+from django.forms.formsets import BaseFormSet, formset_factory
+from django.forms.util import ErrorList
+from django.forms.widgets import (SelectMultiple, HiddenInput,
+ MultipleHiddenInput, media_property)
from django.utils.encoding import smart_unicode, force_unicode
from django.utils.datastructures import SortedDict
from django.utils.text import get_text_list, capfirst
from django.utils.translation import ugettext_lazy as _, ugettext
-from util import ErrorList
-from forms import BaseForm, get_declared_fields
-from fields import Field, ChoiceField
-from widgets import SelectMultiple, HiddenInput, MultipleHiddenInput
-from widgets import media_property
-from formsets import BaseFormSet, formset_factory
__all__ = (
'ModelForm', 'BaseModelForm', 'model_to_dict', 'fields_for_model',
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 3797c163bd..1c16f288a9 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -2,13 +2,15 @@
HTML Widget classes
"""
+from __future__ import absolute_import
+
import copy
import datetime
from itertools import chain
from urlparse import urljoin
-from util import flatatt
from django.conf import settings
+from django.forms.util import flatatt
from django.utils.datastructures import MultiValueDict, MergeDict
from django.utils.html import escape, conditional_escape
from django.utils.translation import ugettext, ugettext_lazy
diff --git a/django/template/base.py b/django/template/base.py
index 8001e93d5f..3e0c14aa03 100644
--- a/django/template/base.py
+++ b/django/template/base.py
@@ -1,3 +1,5 @@
+from __future__ import absolute_import
+
import re
from functools import partial
from inspect import getargspec
@@ -141,7 +143,7 @@ class Template(object):
def compile_string(template_string, origin):
"Compiles template_string into NodeList ready for rendering"
if settings.TEMPLATE_DEBUG:
- from debug import DebugLexer, DebugParser
+ from django.template.debug import DebugLexer, DebugParser
lexer_class, parser_class = DebugLexer, DebugParser
else:
lexer_class, parser_class = Lexer, Parser