Fixed #4318 -- Fixed unused imports and other various style tweaks in newforms. Thanks, Gary Wilson

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5263 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2007-05-16 21:20:35 +00:00
parent 6f44cffc77
commit 4868af8a57
6 changed files with 35 additions and 27 deletions

View File

@ -2,9 +2,10 @@
Extra HTML Widget classes Extra HTML Widget classes
""" """
import datetime
from django.newforms.widgets import Widget, Select from django.newforms.widgets import Widget, Select
from django.utils.dates import MONTHS from django.utils.dates import MONTHS
import datetime
__all__ = ('SelectDateWidget',) __all__ = ('SelectDateWidget',)

View File

@ -2,14 +2,16 @@
Field classes Field classes
""" """
from django.utils.translation import gettext
from django.utils.encoding import smart_unicode
from util import ErrorList, ValidationError
from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple
import datetime import datetime
import re import re
import time import time
from django.utils.translation import gettext
from django.utils.encoding import smart_unicode
from util import ErrorList, ValidationError
from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple
__all__ = ( __all__ = (
'Field', 'CharField', 'IntegerField', 'Field', 'CharField', 'IntegerField',
'DEFAULT_DATE_INPUT_FORMATS', 'DateField', 'DEFAULT_DATE_INPUT_FORMATS', 'DateField',

View File

@ -2,13 +2,15 @@
Form classes Form classes
""" """
from django.utils.datastructures import SortedDict, MultiValueDict import copy
from django.utils.datastructures import SortedDict
from django.utils.html import escape from django.utils.html import escape
from django.utils.encoding import StrAndUnicode from django.utils.encoding import StrAndUnicode
from fields import Field from fields import Field
from widgets import TextInput, Textarea, HiddenInput, MultipleHiddenInput from widgets import TextInput, Textarea
from util import flatatt, ErrorDict, ErrorList, ValidationError from util import flatatt, ErrorDict, ErrorList, ValidationError
import copy
__all__ = ('BaseForm', 'Form') __all__ = ('BaseForm', 'Form')

View File

@ -4,13 +4,16 @@ and database field objects.
""" """
from django.utils.translation import gettext from django.utils.translation import gettext
from util import ValidationError from util import ValidationError
from forms import BaseForm, DeclarativeFieldsMetaclass, SortedDictFromList from forms import BaseForm, SortedDictFromList
from fields import Field, ChoiceField from fields import Field, ChoiceField
from widgets import Select, SelectMultiple, MultipleHiddenInput from widgets import Select, SelectMultiple, MultipleHiddenInput
__all__ = ('save_instance', 'form_for_model', 'form_for_instance', 'form_for_fields', __all__ = (
'ModelChoiceField', 'ModelMultipleChoiceField') 'save_instance', 'form_for_model', 'form_for_instance', 'form_for_fields',
'ModelChoiceField', 'ModelMultipleChoiceField'
)
def save_instance(form, instance, fields=None, fail_message='saved', commit=True): def save_instance(form, instance, fields=None, fail_message='saved', commit=True):
""" """

View File

@ -1,6 +1,4 @@
from django.conf import settings
from django.utils.html import escape from django.utils.html import escape
from django.utils.functional import Promise, lazy
from django.utils.encoding import smart_unicode from django.utils.encoding import smart_unicode
# Converts a dictionary to a single string with key="value", XML-style with # Converts a dictionary to a single string with key="value", XML-style with

View File

@ -2,24 +2,26 @@
HTML Widget classes HTML Widget classes
""" """
__all__ = (
'Widget', 'TextInput', 'PasswordInput', 'HiddenInput', 'MultipleHiddenInput',
'FileInput', 'Textarea', 'CheckboxInput',
'Select', 'NullBooleanSelect', 'SelectMultiple', 'RadioSelect', 'CheckboxSelectMultiple',
'MultiWidget', 'SplitDateTimeWidget',
)
from util import flatatt
from django.utils.datastructures import MultiValueDict
from django.utils.html import escape
from django.utils.translation import gettext
from django.utils.encoding import StrAndUnicode, smart_unicode
from itertools import chain
try: try:
set # Only available in Python 2.4+ set # Only available in Python 2.4+
except NameError: except NameError:
from sets import Set as set # Python 2.3 fallback from sets import Set as set # Python 2.3 fallback
from itertools import chain
from django.utils.datastructures import MultiValueDict
from django.utils.html import escape
from django.utils.translation import gettext
from django.utils.encoding import StrAndUnicode, smart_unicode
from util import flatatt
__all__ = (
'Widget', 'TextInput', 'PasswordInput',
'HiddenInput', 'MultipleHiddenInput',
'FileInput', 'Textarea', 'CheckboxInput',
'Select', 'NullBooleanSelect', 'SelectMultiple', 'RadioSelect',
'CheckboxSelectMultiple', 'MultiWidget', 'SplitDateTimeWidget',
)
class Widget(object): class Widget(object):
is_hidden = False # Determines whether this corresponds to an <input type="hidden">. is_hidden = False # Determines whether this corresponds to an <input type="hidden">.