Loading docs/admin.txt +2 −2 Original line number Diff line number Diff line Loading @@ -494,7 +494,7 @@ on your ``ModelAdmin``:: Keep in mind that this will be prepended with ``MEDIA_URL``. The same rules apply as `regular media definitions on forms`_. .. _regular media definitions on forms: ../newforms/#media .. _regular media definitions on forms: ../forms/#media ``InlineModelAdmin`` objects ============================ Loading Loading @@ -558,7 +558,7 @@ inline. This controls the number of extra forms the formset will display in addition to the initial forms. See the `formsets documentation`_ for more information. .. _formsets documentation: ../newforms/#formsets .. _formsets documentation: ../forms/#formsets ``max_num`` ~~~~~~~~~~~ Loading docs/forms.txt +4 −4 Original line number Diff line number Diff line Loading @@ -2191,7 +2191,7 @@ A formset is a layer of abstraction to working with multiple forms on the same page. It can be best compared to a data grid. Let's say you have the following form:: >>> from django import newforms as forms >>> from django import forms >>> class ArticleForm(forms.Form): ... title = forms.CharField() ... pub_date = forms.DateField() Loading @@ -2199,7 +2199,7 @@ form:: You might want to allow the user to create several articles at once. To create a formset of out of an ``ArticleForm`` you would do:: >>> from django.newforms.formsets import formset_factory >>> from django.forms.formsets import formset_factory >>> ArticleFormSet = formset_factory(ArticleForm) You now have created a formset named ``ArticleFormSet``. The formset gives you Loading Loading @@ -2308,7 +2308,7 @@ an exception:: >>> formset = ArticleFormSet(data) Traceback (most recent call last): ... django.newforms.util.ValidationError: [u'ManagementForm data is missing or has been tampered with'] django.forms.util.ValidationError: [u'ManagementForm data is missing or has been tampered with'] It is used to keep track of how many form instances are being displayed. If you are adding new forms via javascript, you should increment the count fields Loading @@ -2320,7 +2320,7 @@ Custom formset validation A formset has a ``clean`` method similar to the one on a ``Form`` class. This is where you define your own validation that deals at the formset level:: >>> from django.newforms.formsets import BaseFormSet >>> from django.forms.formsets import BaseFormSet >>> class BaseArticleFormSet(BaseFormSet): ... def clean(self): Loading docs/generic_views.txt +10 −10 Original line number Diff line number Diff line Loading @@ -909,10 +909,10 @@ for creating, editing and deleting objects. **Changed in Django development version:** ``django.views.generic.create_update.create_object`` and ``django.views.generic.create_update.update_object`` now use `newforms`_ to build and display the form. ``django.views.generic.create_update.update_object`` now use the new `forms library`_ to build and display the form. .. _newforms: ../newforms/ .. _forms library: ../forms/ ``django.views.generic.create_update.create_object`` ---------------------------------------------------- Loading @@ -927,7 +927,7 @@ validation errors (if there are any) and saving the object. * Either ``form_class`` or ``model`` is required. If you provide ``form_class``, it should be a ``django.newforms.ModelForm`` subclass. Use this argument when you need ``django.forms.ModelForm`` subclass. Use this argument when you need to customize the model's form. See the `ModelForm docs`_ for more information. Loading Loading @@ -973,7 +973,7 @@ If ``template_name`` isn't specified, this view will use the template In addition to ``extra_context``, the template's context will be: * ``form``: A ``django.newforms.ModelForm`` instance representing the form * ``form``: A ``django.forms.ModelForm`` instance representing the form for creating the object. This lets you refer to form fields easily in the template system. Loading @@ -988,7 +988,7 @@ In addition to ``extra_context``, the template's context will be: ``Form`` objects in templates. .. _authentication system: ../authentication/ .. _ModelForm docs: ../newforms/modelforms .. _ModelForm docs: ../forms/modelforms .. _forms documentation: ../forms/ ``django.views.generic.create_update.update_object`` Loading @@ -1005,7 +1005,7 @@ object. This uses the automatic manipulators that come with Django models. * Either ``form_class`` or ``model`` is required. If you provide ``form_class``, it should be a ``django.newforms.ModelForm`` subclass. Use this argument when you need ``django.forms.ModelForm`` subclass. Use this argument when you need to customize the model's form. See the `ModelForm docs`_ for more information. Loading Loading @@ -1063,7 +1063,7 @@ If ``template_name`` isn't specified, this view will use the template In addition to ``extra_context``, the template's context will be: * ``form``: A ``django.newforms.ModelForm`` instance representing the form * ``form``: A ``django.forms.ModelForm`` instance representing the form for editing the object. This lets you refer to form fields easily in the template system. Loading @@ -1074,7 +1074,7 @@ In addition to ``extra_context``, the template's context will be: <p>{{ form.address.label_tag }} {{ form.address }}</p> </form> See the `newforms documentation`_ for more information about using See the `forms documentation`_ for more information about using ``Form`` objects in templates. * ``object``: The original object being edited. This variable's name Loading docs/modelforms.txt +3 −3 Original line number Diff line number Diff line Loading @@ -384,7 +384,7 @@ Similar to regular formsets there are a couple enhanced formset classes that provide all the right things to work with your models. Lets reuse the ``Author`` model from above:: >>> from django.newforms.models import modelformset_factory >>> from django.forms.models import modelformset_factory >>> AuthorFormSet = modelformset_factory(Author) This will create a formset that is capable of working with the data associated Loading Loading @@ -417,7 +417,7 @@ configurable:: Alternatively, you can use a subclassing based approach:: from django.newforms.models import BaseModelFormSet from django.forms.models import BaseModelFormSet class BaseAuthorFormSet(BaseModelFormSet): def get_queryset(self): Loading Loading @@ -494,7 +494,7 @@ with related objects through a foreign key. Suppose you have two models ``Author`` and ``Book``. You want to create a formset that works with the books of a specific author. Here is how you could accomplish this:: >>> from django.newforms.models import inlineformset_factory >>> from django.forms.models import inlineformset_factory >>> BookFormSet = inlineformset_factory(Author, Book) >>> author = Author.objects.get(name=u'Orson Scott Card') >>> formset = BookFormSet(instance=author) docs/testing.txt +1 −1 Original line number Diff line number Diff line Loading @@ -864,7 +864,7 @@ useful for testing Web applications: rendered on the form. ``form`` is the name the ``Form`` instance was given in the template context. Note that this works only for ``newforms.Form`` instances, not context. Note that this works only for ``forms.Form`` instances, not ``oldforms.Form`` instances. ``field`` is the name of the field on the form to check. If ``field`` Loading Loading
docs/admin.txt +2 −2 Original line number Diff line number Diff line Loading @@ -494,7 +494,7 @@ on your ``ModelAdmin``:: Keep in mind that this will be prepended with ``MEDIA_URL``. The same rules apply as `regular media definitions on forms`_. .. _regular media definitions on forms: ../newforms/#media .. _regular media definitions on forms: ../forms/#media ``InlineModelAdmin`` objects ============================ Loading Loading @@ -558,7 +558,7 @@ inline. This controls the number of extra forms the formset will display in addition to the initial forms. See the `formsets documentation`_ for more information. .. _formsets documentation: ../newforms/#formsets .. _formsets documentation: ../forms/#formsets ``max_num`` ~~~~~~~~~~~ Loading
docs/forms.txt +4 −4 Original line number Diff line number Diff line Loading @@ -2191,7 +2191,7 @@ A formset is a layer of abstraction to working with multiple forms on the same page. It can be best compared to a data grid. Let's say you have the following form:: >>> from django import newforms as forms >>> from django import forms >>> class ArticleForm(forms.Form): ... title = forms.CharField() ... pub_date = forms.DateField() Loading @@ -2199,7 +2199,7 @@ form:: You might want to allow the user to create several articles at once. To create a formset of out of an ``ArticleForm`` you would do:: >>> from django.newforms.formsets import formset_factory >>> from django.forms.formsets import formset_factory >>> ArticleFormSet = formset_factory(ArticleForm) You now have created a formset named ``ArticleFormSet``. The formset gives you Loading Loading @@ -2308,7 +2308,7 @@ an exception:: >>> formset = ArticleFormSet(data) Traceback (most recent call last): ... django.newforms.util.ValidationError: [u'ManagementForm data is missing or has been tampered with'] django.forms.util.ValidationError: [u'ManagementForm data is missing or has been tampered with'] It is used to keep track of how many form instances are being displayed. If you are adding new forms via javascript, you should increment the count fields Loading @@ -2320,7 +2320,7 @@ Custom formset validation A formset has a ``clean`` method similar to the one on a ``Form`` class. This is where you define your own validation that deals at the formset level:: >>> from django.newforms.formsets import BaseFormSet >>> from django.forms.formsets import BaseFormSet >>> class BaseArticleFormSet(BaseFormSet): ... def clean(self): Loading
docs/generic_views.txt +10 −10 Original line number Diff line number Diff line Loading @@ -909,10 +909,10 @@ for creating, editing and deleting objects. **Changed in Django development version:** ``django.views.generic.create_update.create_object`` and ``django.views.generic.create_update.update_object`` now use `newforms`_ to build and display the form. ``django.views.generic.create_update.update_object`` now use the new `forms library`_ to build and display the form. .. _newforms: ../newforms/ .. _forms library: ../forms/ ``django.views.generic.create_update.create_object`` ---------------------------------------------------- Loading @@ -927,7 +927,7 @@ validation errors (if there are any) and saving the object. * Either ``form_class`` or ``model`` is required. If you provide ``form_class``, it should be a ``django.newforms.ModelForm`` subclass. Use this argument when you need ``django.forms.ModelForm`` subclass. Use this argument when you need to customize the model's form. See the `ModelForm docs`_ for more information. Loading Loading @@ -973,7 +973,7 @@ If ``template_name`` isn't specified, this view will use the template In addition to ``extra_context``, the template's context will be: * ``form``: A ``django.newforms.ModelForm`` instance representing the form * ``form``: A ``django.forms.ModelForm`` instance representing the form for creating the object. This lets you refer to form fields easily in the template system. Loading @@ -988,7 +988,7 @@ In addition to ``extra_context``, the template's context will be: ``Form`` objects in templates. .. _authentication system: ../authentication/ .. _ModelForm docs: ../newforms/modelforms .. _ModelForm docs: ../forms/modelforms .. _forms documentation: ../forms/ ``django.views.generic.create_update.update_object`` Loading @@ -1005,7 +1005,7 @@ object. This uses the automatic manipulators that come with Django models. * Either ``form_class`` or ``model`` is required. If you provide ``form_class``, it should be a ``django.newforms.ModelForm`` subclass. Use this argument when you need ``django.forms.ModelForm`` subclass. Use this argument when you need to customize the model's form. See the `ModelForm docs`_ for more information. Loading Loading @@ -1063,7 +1063,7 @@ If ``template_name`` isn't specified, this view will use the template In addition to ``extra_context``, the template's context will be: * ``form``: A ``django.newforms.ModelForm`` instance representing the form * ``form``: A ``django.forms.ModelForm`` instance representing the form for editing the object. This lets you refer to form fields easily in the template system. Loading @@ -1074,7 +1074,7 @@ In addition to ``extra_context``, the template's context will be: <p>{{ form.address.label_tag }} {{ form.address }}</p> </form> See the `newforms documentation`_ for more information about using See the `forms documentation`_ for more information about using ``Form`` objects in templates. * ``object``: The original object being edited. This variable's name Loading
docs/modelforms.txt +3 −3 Original line number Diff line number Diff line Loading @@ -384,7 +384,7 @@ Similar to regular formsets there are a couple enhanced formset classes that provide all the right things to work with your models. Lets reuse the ``Author`` model from above:: >>> from django.newforms.models import modelformset_factory >>> from django.forms.models import modelformset_factory >>> AuthorFormSet = modelformset_factory(Author) This will create a formset that is capable of working with the data associated Loading Loading @@ -417,7 +417,7 @@ configurable:: Alternatively, you can use a subclassing based approach:: from django.newforms.models import BaseModelFormSet from django.forms.models import BaseModelFormSet class BaseAuthorFormSet(BaseModelFormSet): def get_queryset(self): Loading Loading @@ -494,7 +494,7 @@ with related objects through a foreign key. Suppose you have two models ``Author`` and ``Book``. You want to create a formset that works with the books of a specific author. Here is how you could accomplish this:: >>> from django.newforms.models import inlineformset_factory >>> from django.forms.models import inlineformset_factory >>> BookFormSet = inlineformset_factory(Author, Book) >>> author = Author.objects.get(name=u'Orson Scott Card') >>> formset = BookFormSet(instance=author)
docs/testing.txt +1 −1 Original line number Diff line number Diff line Loading @@ -864,7 +864,7 @@ useful for testing Web applications: rendered on the form. ``form`` is the name the ``Form`` instance was given in the template context. Note that this works only for ``newforms.Form`` instances, not context. Note that this works only for ``forms.Form`` instances, not ``oldforms.Form`` instances. ``field`` is the name of the field on the form to check. If ``field`` Loading