Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 46786b4193e04d398532bbfc3dcf63c03c1793cb 1 parent 39af273
Jacob Kaplan-Moss jacobian authored
Showing with 133 additions and 128 deletions.
  1. +6 −6 django/contrib/admin/options.py
  2. +1 −1  django/contrib/admin/validation.py
  3. +3 −3 django/contrib/admin/widgets.py
  4. +1 −1  django/contrib/auth/forms.py
  5. +1 −1  django/contrib/formtools/tests.py
  6. +1 −1  django/contrib/formtools/wizard.py
  7. +2 −2 django/contrib/localflavor/ar/forms.py
  8. +3 −3 django/contrib/localflavor/au/forms.py
  9. +2 −2 django/contrib/localflavor/br/forms.py
  10. +3 −3 django/contrib/localflavor/ca/forms.py
  11. +2 −2 django/contrib/localflavor/ch/forms.py
  12. +2 −2 django/contrib/localflavor/cl/forms.py
  13. +2 −2 django/contrib/localflavor/de/forms.py
  14. +2 −2 django/contrib/localflavor/es/forms.py
  15. +2 −2 django/contrib/localflavor/fi/forms.py
  16. +2 −2 django/contrib/localflavor/fr/forms.py
  17. +1 −1  django/contrib/localflavor/generic/forms.py
  18. +2 −2 django/contrib/localflavor/in_/forms.py
  19. +3 −3 django/contrib/localflavor/is_/forms.py
  20. +2 −2 django/contrib/localflavor/it/forms.py
  21. +2 −2 django/contrib/localflavor/jp/forms.py
  22. +1 −1  django/contrib/localflavor/mx/forms.py
  23. +2 −2 django/contrib/localflavor/nl/forms.py
  24. +2 −2 django/contrib/localflavor/no/forms.py
  25. +2 −2 django/contrib/localflavor/pe/forms.py
  26. +2 −2 django/contrib/localflavor/pl/forms.py
  27. +1 −1  django/contrib/localflavor/sk/forms.py
  28. +2 −2 django/contrib/localflavor/uk/forms.py
  29. +2 −2 django/contrib/localflavor/us/forms.py
  30. +2 −2 django/contrib/localflavor/za/forms.py
  31. +2 −2 django/db/models/fields/__init__.py
  32. +1 −1  django/db/models/fields/related.py
  33. +17 −1 django/forms/__init__.py
  34. 0  django/{newforms → forms}/extras/__init__.py
  35. +1 −1  django/{newforms → forms}/extras/widgets.py
  36. 0  django/{newforms → forms}/fields.py
  37. 0  django/{newforms → forms}/forms.py
  38. 0  django/{newforms → forms}/formsets.py
  39. 0  django/{newforms → forms}/models.py
  40. 0  django/{newforms → forms}/util.py
  41. 0  django/{newforms → forms}/widgets.py
  42. +7 −18 django/newforms/__init__.py
  43. +1 −1  django/views/generic/create_update.py
  44. +1 −1  tests/modeltests/many_to_one/models.py
  45. +5 −5 tests/modeltests/model_forms/models.py
  46. +2 −2 tests/modeltests/model_formsets/models.py
  47. +2 −2 tests/modeltests/test_client/views.py
  48. +1 −1  tests/regressiontests/forms/error_messages.py
  49. +4 −4 tests/regressiontests/forms/extra.py
  50. +9 −9 tests/regressiontests/forms/fields.py
  51. +1 −1  tests/regressiontests/forms/forms.py
  52. +2 −2 tests/regressiontests/forms/formsets.py
  53. +1 −1  tests/regressiontests/forms/media.py
  54. +1 −1  tests/regressiontests/forms/models.py
  55. +1 −1  tests/regressiontests/forms/regressions.py
  56. +3 −3 tests/regressiontests/forms/util.py
  57. +2 −2 tests/regressiontests/forms/widgets.py
  58. +1 −1  tests/regressiontests/inline_formsets/models.py
  59. +6 −6 tests/regressiontests/modeladmin/models.py
  60. +1 −1  tests/regressiontests/views/views.py
12 django/contrib/admin/options.py
View
@@ -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 @@ def pk_field(self):
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):
2  django/contrib/admin/validation.py
View
@@ -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
6 django/contrib/admin/widgets.py
View
@@ -4,9 +4,9 @@
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 _
2  django/contrib/auth/forms.py
View
@@ -3,7 +3,7 @@
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):
2  django/contrib/formtools/tests.py
View
@@ -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
2  django/contrib/formtools/wizard.py
View
@@ -4,7 +4,7 @@
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
4 django/contrib/localflavor/ar/forms.py
View
@@ -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 _
6 django/contrib/localflavor/au/forms.py
View
@@ -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
4 django/contrib/localflavor/br/forms.py
View
@@ -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
6 django/contrib/localflavor/ca/forms.py
View
@@ -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
4 django/contrib/localflavor/ch/forms.py
View
@@ -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
4 django/contrib/localflavor/cl/forms.py
View
@@ -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
4 django/contrib/localflavor/de/forms.py
View
@@ -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
4 django/contrib/localflavor/es/forms.py
View
@@ -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
4 django/contrib/localflavor/fi/forms.py
View
@@ -3,8 +3,8 @@
"""
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):
4 django/contrib/localflavor/fr/forms.py
View
@@ -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
2  django/contrib/localflavor/generic/forms.py
View
@@ -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'
4 django/contrib/localflavor/in_/forms.py
View
@@ -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
6 django/contrib/localflavor/is_/forms.py
View
@@ -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
4 django/contrib/localflavor/it/forms.py
View
@@ -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
4 django/contrib/localflavor/jp/forms.py
View
@@ -3,9 +3,9 @@
"""
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):
"""
2  django/contrib/localflavor/mx/forms.py
View
@@ -2,7 +2,7 @@
Mexican-specific form helpers.
"""
-from django.newforms.fields import Select
+from django.forms.fields import Select
class MXStateSelect(Select):
"""
4 django/contrib/localflavor/nl/forms.py
View
@@ -4,8 +4,8 @@
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
4 django/contrib/localflavor/no/forms.py
View
@@ -3,8 +3,8 @@
"""
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):
4 django/contrib/localflavor/pe/forms.py
View
@@ -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):
4 django/contrib/localflavor/pl/forms.py
View
@@ -4,8 +4,8 @@
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):
2  django/contrib/localflavor/sk/forms.py
View
@@ -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):
4 django/contrib/localflavor/uk/forms.py
View
@@ -4,8 +4,8 @@
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):
4 django/contrib/localflavor/us/forms.py
View
@@ -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
4 django/contrib/localflavor/za/forms.py
View
@@ -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
4 django/db/models/fields/__init__.py
View
@@ -14,7 +14,7 @@
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 @@ def save_form_data(self, instance, data):
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)))
2  django/db/models/fields/related.py
View
@@ -9,7 +9,7 @@
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:
18 django/forms/__init__.py
View
@@ -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 *
0  django/newforms/extras/__init__.py → django/forms/extras/__init__.py
View
File renamed without changes
2  django/newforms/extras/widgets.py → django/forms/extras/widgets.py
View
@@ -5,7 +5,7 @@
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
0  django/newforms/fields.py → django/forms/fields.py
View
File renamed without changes
0  django/newforms/forms.py → django/forms/forms.py
View
File renamed without changes
0  django/newforms/formsets.py → django/forms/formsets.py
View
File renamed without changes
0  django/newforms/models.py → django/forms/models.py
View
File renamed without changes
0  django/newforms/util.py → django/forms/util.py
View
File renamed without changes
0  django/newforms/widgets.py → django/forms/widgets.py
View
File renamed without changes
25 django/newforms/__init__.py
View
@@ -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 *
+import warnings
+warnings.warn(
+ category = DeprecationWarning,
+ message = "django.newforms is no longer new. Import django.forms instead.",
+ stacklevel = 2
+)
+from django.forms import *
2  django/views/generic/create_update.py
View
@@ -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
2  tests/modeltests/many_to_one/models.py
View
@@ -155,7 +155,7 @@ class Meta:
[<Article: John's second story>, <Article: This is a test>]
# 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'])
[<Article: John's second story>, <Article: This is a test>]
10 tests/modeltests/model_forms/models.py
View
@@ -79,8 +79,8 @@ def __unicode__(self):
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 @@ def __unicode__(self):
... model = Category
>>> CategoryForm.base_fields['url'].__class__
-<class 'django.newforms.fields.BooleanField'>
+<class 'django.forms.fields.BooleanField'>
Using 'fields'.
@@ -211,7 +211,7 @@ def __unicode__(self):
# 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 @@ def __unicode__(self):
# ModelChoiceField ############################################################
->>> from django.newforms import ModelChoiceField, ModelMultipleChoiceField
+>>> from django.forms import ModelChoiceField, ModelMultipleChoiceField
>>> f = ModelChoiceField(Category.objects.all())
>>> list(f.choices)
4 tests/modeltests/model_formsets/models.py
View
@@ -26,7 +26,7 @@ def __unicode__(self):
>>> 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 @@ def __unicode__(self):
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')
4 tests/modeltests/test_client/views.py
View
@@ -4,8 +4,8 @@
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):
2  tests/regressiontests/forms/error_messages.py
View
@@ -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 ###################################################################
8 tests/regressiontests/forms/extra.py
View
@@ -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 @@
# 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', '')
<select name="mydate_month" id="id_mydate_month">
@@ -424,7 +424,7 @@
# Test overriding ErrorList in a form #
#######################################
->>> from django.newforms.util import ErrorList
+>>> from django.forms.util import ErrorList
>>> class DivErrorList(ErrorList):
... def __unicode__(self):
... return self.as_divs()
18 tests/regressiontests/forms/fields.py
View
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
tests = r"""
->>> from django.newforms import *
->>> from django.newforms.widgets import RadioFieldRenderer
+>>> from django.forms import *
+>>> from django.forms.widgets import RadioFieldRenderer
>>> from django.core.files.uploadedfile import SimpleUploadedFile
>>> import datetime
>>> import time
@@ -17,7 +17,7 @@
##########
Each Field class does some sort of validation. Each Field has a clean() method,
-which either raises django.newforms.ValidationError or returns the "clean"
+which either raises django.forms.ValidationError or returns the "clean"
data -- usually a Unicode object, but, in some rare cases, a list.
Each Field's __init__() takes at least these parameters:
@@ -1153,29 +1153,29 @@
... return x
...
>>> import os
->>> from django import newforms as forms
+>>> from django import forms
>>> path = forms.__file__
>>> path = os.path.dirname(path) + '/'
>>> fix_os_paths(path)
-'.../django/newforms/'
+'.../django/forms/'
>>> f = forms.FilePathField(path=path)
>>> f.choices.sort()
>>> fix_os_paths(f.choices)
-[('.../django/newforms/__init__.py', '__init__.py'), ('.../django/newforms/__init__.pyc', '__init__.pyc'), ('.../django/newforms/fields.py', 'fields.py'), ('.../django/newforms/fields.pyc', 'fields.pyc'), ('.../django/newforms/forms.py', 'forms.py'), ('.../django/newforms/forms.pyc', 'forms.pyc'), ('.../django/newforms/models.py', 'models.py'), ('.../django/newforms/models.pyc', 'models.pyc'), ('.../django/newforms/util.py', 'util.py'), ('.../django/newforms/util.pyc', 'util.pyc'), ('.../django/newforms/widgets.py', 'widgets.py'), ('.../django/newforms/widgets.pyc', 'widgets.pyc')]
+[('.../django/forms/__init__.py', '__init__.py'), ('.../django/forms/__init__.pyc', '__init__.pyc'), ('.../django/forms/fields.py', 'fields.py'), ('.../django/forms/fields.pyc', 'fields.pyc'), ('.../django/forms/forms.py', 'forms.py'), ('.../django/forms/forms.pyc', 'forms.pyc'), ('.../django/forms/models.py', 'models.py'), ('.../django/forms/models.pyc', 'models.pyc'), ('.../django/forms/util.py', 'util.py'), ('.../django/forms/util.pyc', 'util.pyc'), ('.../django/forms/widgets.py', 'widgets.py'), ('.../django/forms/widgets.pyc', 'widgets.pyc')]
>>> f.clean('fields.py')
Traceback (most recent call last):
...
ValidationError: [u'Select a valid choice. That choice is not one of the available choices.']
>>> fix_os_paths(f.clean(path + 'fields.py'))
-u'.../django/newforms/fields.py'
+u'.../django/forms/fields.py'
>>> f = forms.FilePathField(path=path, match='^.*?\.py$')
>>> f.choices.sort()
>>> fix_os_paths(f.choices)
-[('.../django/newforms/__init__.py', '__init__.py'), ('.../django/newforms/fields.py', 'fields.py'), ('.../django/newforms/forms.py', 'forms.py'), ('.../django/newforms/models.py', 'models.py'), ('.../django/newforms/util.py', 'util.py'), ('.../django/newforms/widgets.py', 'widgets.py')]
+[('.../django/forms/__init__.py', '__init__.py'), ('.../django/forms/fields.py', 'fields.py'), ('.../django/forms/forms.py', 'forms.py'), ('.../django/forms/models.py', 'models.py'), ('.../django/forms/util.py', 'util.py'), ('.../django/forms/widgets.py', 'widgets.py')]
>>> f = forms.FilePathField(path=path, recursive=True, match='^.*?\.py$')
>>> f.choices.sort()
>>> fix_os_paths(f.choices)
-[('.../django/newforms/__init__.py', '__init__.py'), ('.../django/newforms/extras/__init__.py', 'extras/__init__.py'), ('.../django/newforms/extras/widgets.py', 'extras/widgets.py'), ('.../django/newforms/fields.py', 'fields.py'), ('.../django/newforms/forms.py', 'forms.py'), ('.../django/newforms/models.py', 'models.py'), ('.../django/newforms/util.py', 'util.py'), ('.../django/newforms/widgets.py', 'widgets.py')]
+[('.../django/forms/__init__.py', '__init__.py'), ('.../django/forms/extras/__init__.py', 'extras/__init__.py'), ('.../django/forms/extras/widgets.py', 'extras/widgets.py'), ('.../django/forms/fields.py', 'fields.py'), ('.../django/forms/forms.py', 'forms.py'), ('.../django/forms/models.py', 'models.py'), ('.../django/forms/util.py', 'util.py'), ('.../django/forms/widgets.py', 'widgets.py')]
# SplitDateTimeField ##########################################################
2  tests/regressiontests/forms/forms.py
View
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
tests = r"""
->>> from django.newforms import *
+>>> from django.forms import *
>>> from django.core.files.uploadedfile import SimpleUploadedFile
>>> import datetime
>>> import time
4 tests/regressiontests/forms/formsets.py
View
@@ -5,8 +5,8 @@
FormSet allows us to use multiple instance of the same form on 1 page. For now,
the best way to create a FormSet is by using the formset_factory function.
->>> from django.newforms import Form, CharField, IntegerField, ValidationError
->>> from django.newforms.formsets import formset_factory, BaseFormSet
+>>> from django.forms import Form, CharField, IntegerField, ValidationError
+>>> from django.forms.formsets import formset_factory, BaseFormSet
>>> class Choice(Form):
... choice = CharField()
2  tests/regressiontests/forms/media.py
View
@@ -2,7 +2,7 @@
# Tests for the media handling on widgets and forms
media_tests = r"""
->>> from django.newforms import TextInput, Media, TextInput, CharField, Form, MultiWidget
+>>> from django.forms import TextInput, Media, TextInput, CharField, Form, MultiWidget
>>> from django.conf import settings
>>> ORIGINAL_MEDIA_URL = settings.MEDIA_URL
>>> settings.MEDIA_URL = 'http://media.example.com/media/'
2  tests/regressiontests/forms/models.py
View
@@ -15,7 +15,7 @@ class ChoiceModel(models.Model):
name = models.CharField(max_length=10)
__test__ = {'API_TESTS': """
->>> from django.newforms import form_for_model, form_for_instance
+>>> from django.forms import form_for_model, form_for_instance
# Boundary conditions on a PostitiveIntegerField #########################
>>> BoundaryForm = form_for_model(BoundaryModel)
2  tests/regressiontests/forms/regressions.py
View
@@ -3,7 +3,7 @@
tests = r"""
It should be possible to re-use attribute dictionaries (#3810)
->>> from django.newforms import *
+>>> from django.forms import *
>>> extra_attrs = {'class': 'special'}
>>> class TestForm(Form):
... f1 = CharField(max_length=10, widget=TextInput(attrs=extra_attrs))
6 tests/regressiontests/forms/util.py
View
@@ -1,17 +1,17 @@
# coding: utf-8
"""
-Tests for newforms/util.py module.
+Tests for forms/util.py module.
"""
tests = r"""
->>> from django.newforms.util import *
+>>> from django.forms.util import *
>>> from django.utils.translation import ugettext_lazy
###########
# flatatt #
###########
->>> from django.newforms.util import flatatt
+>>> from django.forms.util import flatatt
>>> flatatt({'id': "header"})
u' id="header"'
>>> flatatt({'class': "news", 'title': "Read this"})
4 tests/regressiontests/forms/widgets.py
View
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
tests = r"""
->>> from django.newforms import *
->>> from django.newforms.widgets import RadioFieldRenderer
+>>> from django.forms import *
+>>> from django.forms.widgets import RadioFieldRenderer
>>> from django.utils.safestring import mark_safe
>>> import datetime
>>> import time
2  tests/regressiontests/inline_formsets/models.py
View
@@ -15,7 +15,7 @@ class Child(models.Model):
__test__ = {'API_TESTS': """
->>> from django.newforms.models import inlineformset_factory
+>>> from django.forms.models import inlineformset_factory
Child has two ForeignKeys to Parent, so if we don't specify which one to use
12 tests/regressiontests/modeladmin/models.py
View
@@ -119,7 +119,7 @@ class and an AdminSite instance, so let's just go ahead and do that manually
If we specify a form, it should use it allowing custom validation to work
properly. This won't, however, break any of the admin widgets or media.
->>> from django import newforms as forms
+>>> from django import forms
>>> class AdminBandForm(forms.ModelForm):
... delete = forms.BooleanField()
...
@@ -174,22 +174,22 @@ class and an AdminSite instance, so let's just go ahead and do that manually
>>> cmafa = cma.get_form(request)
>>> type(cmafa.base_fields['main_band'].widget.widget)
-<class 'django.newforms.widgets.Select'>
+<class 'django.forms.widgets.Select'>
>>> list(cmafa.base_fields['main_band'].widget.choices)
[(u'', u'---------'), (1, u'The Doors')]
>>> type(cmafa.base_fields['opening_band'].widget.widget)
-<class 'django.newforms.widgets.Select'>
+<class 'django.forms.widgets.Select'>
>>> list(cmafa.base_fields['opening_band'].widget.choices)
[(u'', u'---------'), (1, u'The Doors')]
>>> type(cmafa.base_fields['day'].widget)
-<class 'django.newforms.widgets.Select'>
+<class 'django.forms.widgets.Select'>
>>> list(cmafa.base_fields['day'].widget.choices)
[('', '---------'), (1, 'Fri'), (2, 'Sat')]
>>> type(cmafa.base_fields['transport'].widget)
-<class 'django.newforms.widgets.Select'>
+<class 'django.forms.widgets.Select'>
>>> list(cmafa.base_fields['transport'].widget.choices)
[('', '---------'), (1, 'Plane'), (2, 'Train'), (3, 'Bus')]
@@ -849,7 +849,7 @@ class and an AdminSite instance, so let's just go ahead and do that manually
# formset
->>> from django.newforms.models import BaseModelFormSet
+>>> from django.forms.models import BaseModelFormSet
>>> class FakeFormSet(object):
... pass
2  tests/regressiontests/views/views.py
View
@@ -1,5 +1,5 @@
from django.http import HttpResponse
-import django.newforms as forms
+from django import forms
from django.views.generic.create_update import create_object
from models import Article
Please sign in to comment.
Something went wrong with that request. Please try again.