From 46786b4193e04d398532bbfc3dcf63c03c1793cb Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Sat, 19 Jul 2008 01:22:26 +0000 Subject: [PATCH] Fixed #7741: django.newforms is now django.forms. This is obviously a backwards-incompatible change. There's a warning upon import of django.newforms itself, but deeper imports will raise errors. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7971 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/admin/options.py | 12 ++++----- django/contrib/admin/validation.py | 2 +- django/contrib/admin/widgets.py | 6 ++--- django/contrib/auth/forms.py | 2 +- django/contrib/formtools/tests.py | 2 +- django/contrib/formtools/wizard.py | 2 +- django/contrib/localflavor/ar/forms.py | 4 +-- django/contrib/localflavor/au/forms.py | 6 ++--- django/contrib/localflavor/br/forms.py | 4 +-- django/contrib/localflavor/ca/forms.py | 6 ++--- django/contrib/localflavor/ch/forms.py | 4 +-- django/contrib/localflavor/cl/forms.py | 4 +-- django/contrib/localflavor/de/forms.py | 4 +-- django/contrib/localflavor/es/forms.py | 4 +-- django/contrib/localflavor/fi/forms.py | 4 +-- django/contrib/localflavor/fr/forms.py | 4 +-- django/contrib/localflavor/generic/forms.py | 2 +- django/contrib/localflavor/in_/forms.py | 4 +-- django/contrib/localflavor/is_/forms.py | 6 ++--- django/contrib/localflavor/it/forms.py | 4 +-- django/contrib/localflavor/jp/forms.py | 4 +-- django/contrib/localflavor/mx/forms.py | 2 +- django/contrib/localflavor/nl/forms.py | 4 +-- django/contrib/localflavor/no/forms.py | 4 +-- django/contrib/localflavor/pe/forms.py | 4 +-- django/contrib/localflavor/pl/forms.py | 4 +-- django/contrib/localflavor/sk/forms.py | 2 +- django/contrib/localflavor/uk/forms.py | 4 +-- django/contrib/localflavor/us/forms.py | 4 +-- django/contrib/localflavor/za/forms.py | 4 +-- django/db/models/fields/__init__.py | 4 +-- django/db/models/fields/related.py | 2 +- django/forms/__init__.py | 18 ++++++++++++- django/{newforms => forms}/extras/__init__.py | 0 django/{newforms => forms}/extras/widgets.py | 2 +- django/{newforms => forms}/fields.py | 0 django/{newforms => forms}/forms.py | 0 django/{newforms => forms}/formsets.py | 0 django/{newforms => forms}/models.py | 0 django/{newforms => forms}/util.py | 0 django/{newforms => forms}/widgets.py | 0 django/newforms/__init__.py | 25 ++++++------------- django/views/generic/create_update.py | 2 +- tests/modeltests/many_to_one/models.py | 2 +- tests/modeltests/model_forms/models.py | 10 ++++---- tests/modeltests/model_formsets/models.py | 4 +-- tests/modeltests/test_client/views.py | 4 +-- tests/regressiontests/forms/error_messages.py | 2 +- tests/regressiontests/forms/extra.py | 8 +++--- tests/regressiontests/forms/fields.py | 18 ++++++------- tests/regressiontests/forms/forms.py | 2 +- tests/regressiontests/forms/formsets.py | 4 +-- tests/regressiontests/forms/media.py | 2 +- tests/regressiontests/forms/models.py | 2 +- tests/regressiontests/forms/regressions.py | 2 +- tests/regressiontests/forms/util.py | 6 ++--- tests/regressiontests/forms/widgets.py | 4 +-- .../regressiontests/inline_formsets/models.py | 2 +- tests/regressiontests/modeladmin/models.py | 12 ++++----- tests/regressiontests/views/views.py | 2 +- 60 files changed, 133 insertions(+), 128 deletions(-) rename django/{newforms => forms}/extras/__init__.py (100%) rename django/{newforms => forms}/extras/widgets.py (98%) rename django/{newforms => forms}/fields.py (100%) rename django/{newforms => forms}/forms.py (100%) rename django/{newforms => forms}/formsets.py (100%) rename django/{newforms => forms}/models.py (100%) rename django/{newforms => forms}/util.py (100%) rename django/{newforms => forms}/widgets.py (100%) diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 3b26f7b262..501014a0d5 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -1,8 +1,8 @@ from django import oldforms, template -from django import newforms as forms -from django.newforms.formsets import all_valid -from django.newforms.models import modelform_factory, inlineformset_factory -from django.newforms.models import BaseInlineFormset +from django import forms +from django.forms.formsets import all_valid +from django.forms.models import modelform_factory, inlineformset_factory +from django.forms.models import BaseInlineFormset from django.contrib.contenttypes.models import ContentType from django.contrib.admin import widgets from django.contrib.admin.util import quote, unquote, get_deleted_objects @@ -775,11 +775,11 @@ class InlineAdminForm(AdminForm): return AdminField(self.form, self.formset._pk_field_name, False) def deletion_field(self): - from django.newforms.formsets import DELETION_FIELD_NAME + from django.forms.formsets import DELETION_FIELD_NAME return AdminField(self.form, DELETION_FIELD_NAME, False) def ordering_field(self): - from django.newforms.formsets import ORDERING_FIELD_NAME + from django.forms.formsets import ORDERING_FIELD_NAME return AdminField(self.form, ORDERING_FIELD_NAME, False) class AdminErrorList(forms.util.ErrorList): diff --git a/django/contrib/admin/validation.py b/django/contrib/admin/validation.py index f640cc5100..2c9cb8554d 100644 --- a/django/contrib/admin/validation.py +++ b/django/contrib/admin/validation.py @@ -1,7 +1,7 @@ from django.core.exceptions import ImproperlyConfigured from django.db import models -from django.newforms.models import BaseModelForm, BaseModelFormSet, fields_for_model +from django.forms.models import BaseModelForm, BaseModelFormSet, fields_for_model from django.contrib.admin.options import flatten_fieldsets, BaseModelAdmin from django.contrib.admin.options import HORIZONTAL, VERTICAL diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py index 4ae8889ac4..14ede5c114 100644 --- a/django/contrib/admin/widgets.py +++ b/django/contrib/admin/widgets.py @@ -4,9 +4,9 @@ Form Widget classes specific to the Django admin site. import copy -from django import newforms as forms -from django.newforms.widgets import RadioFieldRenderer -from django.newforms.util import flatatt +from django import forms +from django.forms.widgets import RadioFieldRenderer +from django.forms.util import flatatt from django.utils.datastructures import MultiValueDict from django.utils.text import capfirst, truncate_words from django.utils.translation import ugettext as _ diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py index f63dc7b854..13ddcd3841 100644 --- a/django/contrib/auth/forms.py +++ b/django/contrib/auth/forms.py @@ -3,7 +3,7 @@ from django.contrib.auth import authenticate from django.contrib.sites.models import Site from django.template import Context, loader from django.core import validators -from django import newforms as forms +from django import forms from django.utils.translation import ugettext_lazy as _ class UserCreationForm(forms.ModelForm): diff --git a/django/contrib/formtools/tests.py b/django/contrib/formtools/tests.py index ba241e9dc6..99fe80bbb3 100644 --- a/django/contrib/formtools/tests.py +++ b/django/contrib/formtools/tests.py @@ -1,4 +1,4 @@ -from django import newforms as forms +from django import forms from django.contrib.formtools import preview from django import http from django.conf import settings diff --git a/django/contrib/formtools/wizard.py b/django/contrib/formtools/wizard.py index 398de742ec..7b96d91187 100644 --- a/django/contrib/formtools/wizard.py +++ b/django/contrib/formtools/wizard.py @@ -4,7 +4,7 @@ step and storing the form's state as HTML hidden fields so that no state is stored on the server side. """ -from django import newforms as forms +from django import forms from django.conf import settings from django.http import Http404 from django.shortcuts import render_to_response diff --git a/django/contrib/localflavor/ar/forms.py b/django/contrib/localflavor/ar/forms.py index 464399188f..8e8e1af387 100644 --- a/django/contrib/localflavor/ar/forms.py +++ b/django/contrib/localflavor/ar/forms.py @@ -3,8 +3,8 @@ AR-specific Form helpers. """ -from django.newforms import ValidationError -from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import RegexField, CharField, Select, EMPTY_VALUES from django.utils.encoding import smart_unicode from django.utils.translation import ugettext_lazy as _ diff --git a/django/contrib/localflavor/au/forms.py b/django/contrib/localflavor/au/forms.py index 41d4e04fec..afc3a0cc4c 100644 --- a/django/contrib/localflavor/au/forms.py +++ b/django/contrib/localflavor/au/forms.py @@ -2,9 +2,9 @@ Australian-specific Form helpers """ -from django.newforms import ValidationError -from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES -from django.newforms.util import smart_unicode +from django.forms import ValidationError +from django.forms.fields import Field, RegexField, Select, EMPTY_VALUES +from django.forms.util import smart_unicode from django.utils.translation import ugettext_lazy as _ import re diff --git a/django/contrib/localflavor/br/forms.py b/django/contrib/localflavor/br/forms.py index 81dcb8228b..6d0a0384c6 100644 --- a/django/contrib/localflavor/br/forms.py +++ b/django/contrib/localflavor/br/forms.py @@ -3,8 +3,8 @@ BR-specific Form helpers """ -from django.newforms import ValidationError -from django.newforms.fields import Field, RegexField, CharField, Select, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import Field, RegexField, CharField, Select, EMPTY_VALUES from django.utils.encoding import smart_unicode from django.utils.translation import ugettext_lazy as _ import re diff --git a/django/contrib/localflavor/ca/forms.py b/django/contrib/localflavor/ca/forms.py index 548f85b7f6..327d938373 100644 --- a/django/contrib/localflavor/ca/forms.py +++ b/django/contrib/localflavor/ca/forms.py @@ -2,9 +2,9 @@ Canada-specific Form helpers """ -from django.newforms import ValidationError -from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES -from django.newforms.util import smart_unicode +from django.forms import ValidationError +from django.forms.fields import Field, RegexField, Select, EMPTY_VALUES +from django.forms.util import smart_unicode from django.utils.translation import ugettext_lazy as _ import re diff --git a/django/contrib/localflavor/ch/forms.py b/django/contrib/localflavor/ch/forms.py index e2d3aea944..bd92fcae98 100644 --- a/django/contrib/localflavor/ch/forms.py +++ b/django/contrib/localflavor/ch/forms.py @@ -2,8 +2,8 @@ Swiss-specific Form helpers """ -from django.newforms import ValidationError -from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import Field, RegexField, Select, EMPTY_VALUES from django.utils.encoding import smart_unicode from django.utils.translation import ugettext_lazy as _ import re diff --git a/django/contrib/localflavor/cl/forms.py b/django/contrib/localflavor/cl/forms.py index 69473607a6..61b3ab7aac 100644 --- a/django/contrib/localflavor/cl/forms.py +++ b/django/contrib/localflavor/cl/forms.py @@ -2,8 +2,8 @@ Chile specific form helpers. """ -from django.newforms import ValidationError -from django.newforms.fields import RegexField, Select, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import RegexField, Select, EMPTY_VALUES from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import smart_unicode diff --git a/django/contrib/localflavor/de/forms.py b/django/contrib/localflavor/de/forms.py index c5402fa260..7a1b7c03c8 100644 --- a/django/contrib/localflavor/de/forms.py +++ b/django/contrib/localflavor/de/forms.py @@ -2,8 +2,8 @@ DE-specific Form helpers """ -from django.newforms import ValidationError -from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import Field, RegexField, Select, EMPTY_VALUES from django.utils.translation import ugettext_lazy as _ import re diff --git a/django/contrib/localflavor/es/forms.py b/django/contrib/localflavor/es/forms.py index 57e730b2cf..522f5f4696 100644 --- a/django/contrib/localflavor/es/forms.py +++ b/django/contrib/localflavor/es/forms.py @@ -3,8 +3,8 @@ Spanish-specific Form helpers """ -from django.newforms import ValidationError -from django.newforms.fields import RegexField, Select, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import RegexField, Select, EMPTY_VALUES from django.utils.translation import ugettext_lazy as _ import re diff --git a/django/contrib/localflavor/fi/forms.py b/django/contrib/localflavor/fi/forms.py index e9e0fc1e93..2b82a796fe 100644 --- a/django/contrib/localflavor/fi/forms.py +++ b/django/contrib/localflavor/fi/forms.py @@ -3,8 +3,8 @@ FI-specific Form helpers """ import re -from django.newforms import ValidationError -from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import Field, RegexField, Select, EMPTY_VALUES from django.utils.translation import ugettext_lazy as _ class FIZipCodeField(RegexField): diff --git a/django/contrib/localflavor/fr/forms.py b/django/contrib/localflavor/fr/forms.py index 960e8b221c..8d9d9d7771 100644 --- a/django/contrib/localflavor/fr/forms.py +++ b/django/contrib/localflavor/fr/forms.py @@ -2,8 +2,8 @@ FR-specific Form helpers """ -from django.newforms import ValidationError -from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import Field, RegexField, Select, EMPTY_VALUES from django.utils.encoding import smart_unicode from django.utils.translation import ugettext_lazy as _ import re diff --git a/django/contrib/localflavor/generic/forms.py b/django/contrib/localflavor/generic/forms.py index a5e431e4b3..8bafce7b1b 100644 --- a/django/contrib/localflavor/generic/forms.py +++ b/django/contrib/localflavor/generic/forms.py @@ -1,4 +1,4 @@ -from django import newforms as forms +from django import forms DEFAULT_DATE_INPUT_FORMATS = ( '%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06' diff --git a/django/contrib/localflavor/in_/forms.py b/django/contrib/localflavor/in_/forms.py index 1cb303d772..270b0a09b1 100644 --- a/django/contrib/localflavor/in_/forms.py +++ b/django/contrib/localflavor/in_/forms.py @@ -2,8 +2,8 @@ India-specific Form helpers. """ -from django.newforms import ValidationError -from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import Field, RegexField, Select, EMPTY_VALUES from django.utils.encoding import smart_unicode from django.utils.translation import gettext import re diff --git a/django/contrib/localflavor/is_/forms.py b/django/contrib/localflavor/is_/forms.py index 9f7b6f0211..cab6eb18c0 100644 --- a/django/contrib/localflavor/is_/forms.py +++ b/django/contrib/localflavor/is_/forms.py @@ -2,9 +2,9 @@ Iceland specific form helpers. """ -from django.newforms import ValidationError -from django.newforms.fields import RegexField, EMPTY_VALUES -from django.newforms.widgets import Select +from django.forms import ValidationError +from django.forms.fields import RegexField, EMPTY_VALUES +from django.forms.widgets import Select from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import smart_unicode diff --git a/django/contrib/localflavor/it/forms.py b/django/contrib/localflavor/it/forms.py index 7d4a82dd63..d2d651955a 100644 --- a/django/contrib/localflavor/it/forms.py +++ b/django/contrib/localflavor/it/forms.py @@ -2,8 +2,8 @@ IT-specific Form helpers """ -from django.newforms import ValidationError -from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import Field, RegexField, Select, EMPTY_VALUES from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import smart_unicode from django.contrib.localflavor.it.util import ssn_check_digit, vat_number_check_digit diff --git a/django/contrib/localflavor/jp/forms.py b/django/contrib/localflavor/jp/forms.py index 70def85351..c86dbaf8da 100644 --- a/django/contrib/localflavor/jp/forms.py +++ b/django/contrib/localflavor/jp/forms.py @@ -3,9 +3,9 @@ JP-specific Form helpers """ from django.core import validators -from django.newforms import ValidationError +from django.forms import ValidationError from django.utils.translation import ugettext_lazy as _ -from django.newforms.fields import RegexField, Select +from django.forms.fields import RegexField, Select class JPPostalCodeField(RegexField): """ diff --git a/django/contrib/localflavor/mx/forms.py b/django/contrib/localflavor/mx/forms.py index 5e42cca7d7..95819375ef 100644 --- a/django/contrib/localflavor/mx/forms.py +++ b/django/contrib/localflavor/mx/forms.py @@ -2,7 +2,7 @@ Mexican-specific form helpers. """ -from django.newforms.fields import Select +from django.forms.fields import Select class MXStateSelect(Select): """ diff --git a/django/contrib/localflavor/nl/forms.py b/django/contrib/localflavor/nl/forms.py index 6f9e887339..6dc5319eb7 100644 --- a/django/contrib/localflavor/nl/forms.py +++ b/django/contrib/localflavor/nl/forms.py @@ -4,8 +4,8 @@ NL-specific Form helpers import re -from django.newforms import ValidationError -from django.newforms.fields import Field, Select, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import Field, Select, EMPTY_VALUES from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import smart_unicode diff --git a/django/contrib/localflavor/no/forms.py b/django/contrib/localflavor/no/forms.py index 39c80ec0b2..0fe55adf7e 100644 --- a/django/contrib/localflavor/no/forms.py +++ b/django/contrib/localflavor/no/forms.py @@ -3,8 +3,8 @@ Norwegian-specific Form helpers """ import re, datetime -from django.newforms import ValidationError -from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import Field, RegexField, Select, EMPTY_VALUES from django.utils.translation import ugettext_lazy as _ class NOZipCodeField(RegexField): diff --git a/django/contrib/localflavor/pe/forms.py b/django/contrib/localflavor/pe/forms.py index 328b2e36e1..d192295dcf 100644 --- a/django/contrib/localflavor/pe/forms.py +++ b/django/contrib/localflavor/pe/forms.py @@ -3,8 +3,8 @@ PE-specific Form helpers. """ -from django.newforms import ValidationError -from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import RegexField, CharField, Select, EMPTY_VALUES from django.utils.translation import ugettext_lazy as _ class PEDepartmentSelect(Select): diff --git a/django/contrib/localflavor/pl/forms.py b/django/contrib/localflavor/pl/forms.py index 32d00cc3a8..8410c72a3c 100644 --- a/django/contrib/localflavor/pl/forms.py +++ b/django/contrib/localflavor/pl/forms.py @@ -4,8 +4,8 @@ Polish-specific form helpers import re -from django.newforms import ValidationError -from django.newforms.fields import Select, RegexField +from django.forms import ValidationError +from django.forms.fields import Select, RegexField from django.utils.translation import ugettext_lazy as _ class PLVoivodeshipSelect(Select): diff --git a/django/contrib/localflavor/sk/forms.py b/django/contrib/localflavor/sk/forms.py index d12927ecab..863a61217a 100644 --- a/django/contrib/localflavor/sk/forms.py +++ b/django/contrib/localflavor/sk/forms.py @@ -2,7 +2,7 @@ Slovak-specific form helpers """ -from django.newforms.fields import Select, RegexField +from django.forms.fields import Select, RegexField from django.utils.translation import ugettext_lazy as _ class SKRegionSelect(Select): diff --git a/django/contrib/localflavor/uk/forms.py b/django/contrib/localflavor/uk/forms.py index b3883f6477..7df736444a 100644 --- a/django/contrib/localflavor/uk/forms.py +++ b/django/contrib/localflavor/uk/forms.py @@ -4,8 +4,8 @@ UK-specific Form helpers import re -from django.newforms.fields import CharField, Select -from django.newforms import ValidationError +from django.forms.fields import CharField, Select +from django.forms import ValidationError from django.utils.translation import ugettext_lazy as _ class UKPostcodeField(CharField): diff --git a/django/contrib/localflavor/us/forms.py b/django/contrib/localflavor/us/forms.py index a17062d61f..a744edce74 100644 --- a/django/contrib/localflavor/us/forms.py +++ b/django/contrib/localflavor/us/forms.py @@ -2,8 +2,8 @@ USA-specific Form helpers """ -from django.newforms import ValidationError -from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import Field, RegexField, Select, EMPTY_VALUES from django.utils.encoding import smart_unicode from django.utils.translation import ugettext_lazy as _ import re diff --git a/django/contrib/localflavor/za/forms.py b/django/contrib/localflavor/za/forms.py index b3613b507d..7b7b714398 100644 --- a/django/contrib/localflavor/za/forms.py +++ b/django/contrib/localflavor/za/forms.py @@ -2,8 +2,8 @@ South Africa-specific Form helpers """ -from django.newforms import ValidationError -from django.newforms.fields import Field, RegexField, EMPTY_VALUES +from django.forms import ValidationError +from django.forms.fields import Field, RegexField, EMPTY_VALUES from django.utils.checksums import luhn from django.utils.translation import gettext as _ import re diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 879807d2d2..52eaa435a2 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -14,7 +14,7 @@ from django.dispatch import dispatcher from django.conf import settings from django.core import validators from django import oldforms -from django import newforms as forms +from django import forms from django.core.exceptions import ObjectDoesNotExist from django.utils.datastructures import DictWrapper from django.utils.functional import curry @@ -411,7 +411,7 @@ class Field(object): setattr(instance, self.name, data) def formfield(self, form_class=forms.CharField, **kwargs): - "Returns a django.newforms.Field instance for this database Field." + "Returns a django.forms.Field instance for this database Field." defaults = {'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text} if self.choices: defaults['widget'] = forms.Select(choices=self.get_choices(include_blank=self.blank or not (self.has_default() or 'initial' in kwargs))) diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index 594236b4c6..735dda4969 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -9,7 +9,7 @@ from django.utils.functional import curry from django.utils.encoding import smart_unicode from django.core import validators from django import oldforms -from django import newforms as forms +from django import forms from django.dispatch import dispatcher try: diff --git a/django/forms/__init__.py b/django/forms/__init__.py index 68d3d245a2..0d9c68f9e0 100644 --- a/django/forms/__init__.py +++ b/django/forms/__init__.py @@ -1 +1,17 @@ -from django.oldforms import * +""" +Django validation and HTML form handling. + +TODO: + Default value for field + Field labels + Nestable Forms + FatalValidationError -- short-circuits all other validators on a form + ValidationWarning + "This form field requires foo.js" and form.js_includes() +""" + +from util import ValidationError +from widgets import * +from fields import * +from forms import * +from models import * diff --git a/django/newforms/extras/__init__.py b/django/forms/extras/__init__.py similarity index 100% rename from django/newforms/extras/__init__.py rename to django/forms/extras/__init__.py diff --git a/django/newforms/extras/widgets.py b/django/forms/extras/widgets.py similarity index 98% rename from django/newforms/extras/widgets.py rename to django/forms/extras/widgets.py index e3ef1d7f69..ffa7ba2de2 100644 --- a/django/newforms/extras/widgets.py +++ b/django/forms/extras/widgets.py @@ -5,7 +5,7 @@ Extra HTML Widget classes import datetime import re -from django.newforms.widgets import Widget, Select +from django.forms.widgets import Widget, Select from django.utils.dates import MONTHS from django.utils.safestring import mark_safe diff --git a/django/newforms/fields.py b/django/forms/fields.py similarity index 100% rename from django/newforms/fields.py rename to django/forms/fields.py diff --git a/django/newforms/forms.py b/django/forms/forms.py similarity index 100% rename from django/newforms/forms.py rename to django/forms/forms.py diff --git a/django/newforms/formsets.py b/django/forms/formsets.py similarity index 100% rename from django/newforms/formsets.py rename to django/forms/formsets.py diff --git a/django/newforms/models.py b/django/forms/models.py similarity index 100% rename from django/newforms/models.py rename to django/forms/models.py diff --git a/django/newforms/util.py b/django/forms/util.py similarity index 100% rename from django/newforms/util.py rename to django/forms/util.py diff --git a/django/newforms/widgets.py b/django/forms/widgets.py similarity index 100% rename from django/newforms/widgets.py rename to django/forms/widgets.py diff --git a/django/newforms/__init__.py b/django/newforms/__init__.py index 99631e4e8f..5f319f8c1b 100644 --- a/django/newforms/__init__.py +++ b/django/newforms/__init__.py @@ -1,18 +1,7 @@ -""" -Django validation and HTML form handling. - -TODO: - Default value for field - Field labels - Nestable Forms - FatalValidationError -- short-circuits all other validators on a form - ValidationWarning - "This form field requires foo.js" and form.js_includes() -""" - -from util import ValidationError -from widgets import * -from fields import * -from forms import * -from models import * -from formsets import * \ No newline at end of file +import warnings +warnings.warn( + category = DeprecationWarning, + message = "django.newforms is no longer new. Import django.forms instead.", + stacklevel = 2 +) +from django.forms import * \ No newline at end of file diff --git a/django/views/generic/create_update.py b/django/views/generic/create_update.py index a51661c4a7..4fe639f321 100644 --- a/django/views/generic/create_update.py +++ b/django/views/generic/create_update.py @@ -1,4 +1,4 @@ -from django.newforms.models import ModelFormMetaclass, ModelForm +from django.forms.models import ModelFormMetaclass, ModelForm from django.template import RequestContext, loader from django.http import Http404, HttpResponse, HttpResponseRedirect from django.core.xheaders import populate_xheaders diff --git a/tests/modeltests/many_to_one/models.py b/tests/modeltests/many_to_one/models.py index dfb17b8344..081cffb807 100644 --- a/tests/modeltests/many_to_one/models.py +++ b/tests/modeltests/many_to_one/models.py @@ -155,7 +155,7 @@ False [, ] # And should work fine with the unicode that comes out of -# newforms.Form.cleaned_data +# forms.Form.cleaned_data >>> Article.objects.filter(reporter__first_name__exact='John').extra(where=["many_to_one_reporter.last_name='%s'" % u'Smith']) [, ] diff --git a/tests/modeltests/model_forms/models.py b/tests/modeltests/model_forms/models.py index 6838f11d4e..cc9efd0f94 100644 --- a/tests/modeltests/model_forms/models.py +++ b/tests/modeltests/model_forms/models.py @@ -79,8 +79,8 @@ class ImageFile(models.Model): return self.description __test__ = {'API_TESTS': """ ->>> from django import newforms as forms ->>> from django.newforms.models import ModelForm +>>> from django import forms +>>> from django.forms.models import ModelForm >>> from django.core.files.uploadedfile import SimpleUploadedFile The bare bones, absolutely nothing custom, basic case. @@ -113,7 +113,7 @@ Replacing a field. ... model = Category >>> CategoryForm.base_fields['url'].__class__ - + Using 'fields'. @@ -211,7 +211,7 @@ We can also subclass the Meta inner class to change the fields list. # Old form_for_x tests ####################################################### ->>> from django.newforms import ModelForm, CharField +>>> from django.forms import ModelForm, CharField >>> import datetime >>> Category.objects.all() @@ -605,7 +605,7 @@ the data in the database when the form is instantiated. # ModelChoiceField ############################################################ ->>> from django.newforms import ModelChoiceField, ModelMultipleChoiceField +>>> from django.forms import ModelChoiceField, ModelMultipleChoiceField >>> f = ModelChoiceField(Category.objects.all()) >>> list(f.choices) diff --git a/tests/modeltests/model_formsets/models.py b/tests/modeltests/model_formsets/models.py index 84265450fc..5958b8c27a 100644 --- a/tests/modeltests/model_formsets/models.py +++ b/tests/modeltests/model_formsets/models.py @@ -26,7 +26,7 @@ __test__ = {'API_TESTS': """ >>> from datetime import date ->>> from django.newforms.models import modelformset_factory +>>> from django.forms.models import modelformset_factory >>> qs = Author.objects.all() >>> AuthorFormSet = modelformset_factory(Author, extra=3) @@ -227,7 +227,7 @@ used. We can also create a formset that is tied to a parent model. This is how the admin system's edit inline functionality works. ->>> from django.newforms.models import inlineformset_factory +>>> from django.forms.models import inlineformset_factory >>> AuthorBooksFormSet = inlineformset_factory(Author, Book, can_delete=False, extra=3) >>> author = Author.objects.get(name='Charles Baudelaire') diff --git a/tests/modeltests/test_client/views.py b/tests/modeltests/test_client/views.py index f4eab6462d..111c72e7f5 100644 --- a/tests/modeltests/test_client/views.py +++ b/tests/modeltests/test_client/views.py @@ -4,8 +4,8 @@ from django.core.mail import EmailMessage, SMTPConnection from django.template import Context, Template from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound from django.contrib.auth.decorators import login_required, permission_required -from django.newforms.forms import Form -from django.newforms import fields +from django.forms.forms import Form +from django.forms import fields from django.shortcuts import render_to_response def get_view(request): diff --git a/tests/regressiontests/forms/error_messages.py b/tests/regressiontests/forms/error_messages.py index 580326f894..ec91b57a06 100644 --- a/tests/regressiontests/forms/error_messages.py +++ b/tests/regressiontests/forms/error_messages.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- tests = r""" ->>> from django.newforms import * +>>> from django.forms import * >>> from django.core.files.uploadedfile import SimpleUploadedFile # CharField ################################################################### diff --git a/tests/regressiontests/forms/extra.py b/tests/regressiontests/forms/extra.py index a8b369715d..80f7ef6535 100644 --- a/tests/regressiontests/forms/extra.py +++ b/tests/regressiontests/forms/extra.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- tests = r""" ->>> from django.newforms import * +>>> from django.forms import * >>> from django.utils.encoding import force_unicode >>> import datetime >>> import time @@ -14,12 +14,12 @@ tests = r""" # Extra stuff # ############### -The newforms library comes with some extra, higher-level Field and Widget +The forms library comes with some extra, higher-level Field and Widget classes that demonstrate some of the library's abilities. # SelectDateWidget ############################################################ ->>> from django.newforms.extras import SelectDateWidget +>>> from django.forms.extras import SelectDateWidget >>> w = SelectDateWidget(years=('2007','2008','2009','2010','2011','2012','2013','2014','2015','2016')) >>> print w.render('mydate', '')