summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrian Rosner <brosner@gmail.com>2008-06-10 04:15:06 +0000
committerBrian Rosner <brosner@gmail.com>2008-06-10 04:15:06 +0000
commit1fd3db4ab0d603878104877960de496773d12ad2 (patch)
treef52f6bdc858a9eb25233190f5d50da390a3ee165 /tests
parent4530a408c40647c195f27f81da1315e98e956f96 (diff)
newforms-admin: Removed the leading underscore from modelforms factory functions.
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7605 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/modeltests/model_formsets/models.py14
-rw-r--r--tests/regressiontests/inline_formsets/models.py12
2 files changed, 13 insertions, 13 deletions
diff --git a/tests/modeltests/model_formsets/models.py b/tests/modeltests/model_formsets/models.py
index 9fd50e7521..93bc80ee72 100644
--- a/tests/modeltests/model_formsets/models.py
+++ b/tests/modeltests/model_formsets/models.py
@@ -16,10 +16,10 @@ class Book(models.Model):
__test__ = {'API_TESTS': """
->>> from django.newforms.models import _modelformset_factory
+>>> from django.newforms.models import modelformset_factory
>>> qs = Author.objects.all()
->>> AuthorFormSet = _modelformset_factory(Author, extra=3)
+>>> AuthorFormSet = modelformset_factory(Author, extra=3)
>>> formset = AuthorFormSet(queryset=qs)
>>> for form in formset.forms:
@@ -55,7 +55,7 @@ restrict the Author objects we edit, but in this case we'll use it to display
them in alphabetical order by name.
>>> qs = Author.objects.order_by('name')
->>> AuthorFormSet = _modelformset_factory(Author, extra=1, can_delete=False)
+>>> AuthorFormSet = modelformset_factory(Author, extra=1, can_delete=False)
>>> formset = AuthorFormSet(queryset=qs)
>>> for form in formset.forms:
@@ -94,7 +94,7 @@ This probably shouldn't happen, but it will. If an add form was marked for
deltetion, make sure we don't save that form.
>>> qs = Author.objects.order_by('name')
->>> AuthorFormSet = _modelformset_factory(Author, extra=1, can_delete=True)
+>>> AuthorFormSet = modelformset_factory(Author, extra=1, can_delete=True)
>>> formset = AuthorFormSet(queryset=qs)
>>> for form in formset.forms:
@@ -163,9 +163,9 @@ True
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.newforms.models import inlineformset_factory
->>> AuthorBooksFormSet = _inlineformset_factory(Author, Book, can_delete=False, extra=3)
+>>> AuthorBooksFormSet = inlineformset_factory(Author, Book, can_delete=False, extra=3)
>>> author = Author.objects.get(name='Charles Baudelaire')
>>> formset = AuthorBooksFormSet(instance=author)
@@ -199,7 +199,7 @@ Now that we've added a book to Charles Baudelaire, let's try adding another
one. This time though, an edit form will be available for every existing
book.
->>> AuthorBooksFormSet = _inlineformset_factory(Author, Book, can_delete=False, extra=2)
+>>> AuthorBooksFormSet = inlineformset_factory(Author, Book, can_delete=False, extra=2)
>>> author = Author.objects.get(name='Charles Baudelaire')
>>> formset = AuthorBooksFormSet(instance=author)
diff --git a/tests/regressiontests/inline_formsets/models.py b/tests/regressiontests/inline_formsets/models.py
index 6f197d6ab5..b22f5e297d 100644
--- a/tests/regressiontests/inline_formsets/models.py
+++ b/tests/regressiontests/inline_formsets/models.py
@@ -15,13 +15,13 @@ class Child(models.Model):
__test__ = {'API_TESTS': """
->>> from django.newforms.models import _inlineformset_factory
+>>> from django.newforms.models import inlineformset_factory
Child has two ForeignKeys to Parent, so if we don't specify which one to use
for the inline formset, we should get an exception.
->>> ifs = _inlineformset_factory(Parent, Child)
+>>> ifs = inlineformset_factory(Parent, Child)
Traceback (most recent call last):
...
Exception: <class 'regressiontests.inline_formsets.models.Child'> has more than 1 ForeignKey to <class 'regressiontests.inline_formsets.models.Parent'>
@@ -29,14 +29,14 @@ Exception: <class 'regressiontests.inline_formsets.models.Child'> has more than
These two should both work without a problem.
->>> ifs = _inlineformset_factory(Parent, Child, fk_name='mother')
->>> ifs = _inlineformset_factory(Parent, Child, fk_name='father')
+>>> ifs = inlineformset_factory(Parent, Child, fk_name='mother')
+>>> ifs = inlineformset_factory(Parent, Child, fk_name='father')
If we specify fk_name, but it isn't a ForeignKey from the child model to the
parent model, we should get an exception.
->>> ifs = _inlineformset_factory(Parent, Child, fk_name='school')
+>>> ifs = inlineformset_factory(Parent, Child, fk_name='school')
Traceback (most recent call last):
...
Exception: fk_name 'school' is not a ForeignKey to <class 'regressiontests.inline_formsets.models.Parent'>
@@ -45,7 +45,7 @@ Exception: fk_name 'school' is not a ForeignKey to <class 'regressiontests.inlin
If the field specified in fk_name is not a ForeignKey, we should get an
exception.
->>> ifs = _inlineformset_factory(Parent, Child, fk_name='test')
+>>> ifs = inlineformset_factory(Parent, Child, fk_name='test')
Traceback (most recent call last):
...
Exception: <class 'regressiontests.inline_formsets.models.Child'> has no field named 'test'