Remove several more relative imports.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17007 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor 2011-10-17 16:56:18 +00:00
parent 1856e398c5
commit 544a8372fd
8 changed files with 41 additions and 24 deletions

View File

@ -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<area>\d{3})[-\ ]?(?P<group>\d{2})[-\ ]?(?P<serial>\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)

View File

@ -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)

View File

@ -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']

View File

@ -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'

View File

@ -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',

View File

@ -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',

View File

@ -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

View File

@ -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