diff options
| author | Tim Graham <timograham@gmail.com> | 2013-07-08 12:08:30 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-07-08 12:08:30 -0400 |
| commit | 660c30ed953667b44bdec7058dafe10e0a8ce402 (patch) | |
| tree | f6e757bd44508812e8b2761addde419387e09e3f /docs | |
| parent | 10845751632e843aeb21a030c7df7f9848bf65aa (diff) | |
Fixed #16965 -- Clarified Formset can_delete docs.
Thanks gregcorey@ for the suggestion.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/forms/formsets.txt | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/docs/topics/forms/formsets.txt b/docs/topics/forms/formsets.txt index 29139c5dea..470d9f52e4 100644 --- a/docs/topics/forms/formsets.txt +++ b/docs/topics/forms/formsets.txt @@ -413,7 +413,7 @@ happen when the user changes these values:: Default: ``False`` -Lets you create a formset with the ability to delete:: +Lets you create a formset with the ability to select forms for deletion:: >>> from django.forms.formsets import formset_factory >>> from myapp.forms import ArticleForm @@ -461,6 +461,13 @@ delete fields you can access them with ``deleted_forms``:: >>> [form.cleaned_data for form in formset.deleted_forms] [{'DELETE': True, 'pub_date': datetime.date(2008, 5, 10), 'title': u'Article #1'}] +If you are using a :class:`ModelFormSet<django.forms.models.BaseModelFormSet>`, +model instances for deleted forms will be deleted when you call +``formset.save()``. On the other hand, if you are using a plain ``FormSet``, +it's up to you to handle ``formset.deleted_forms``, perhaps in your formset's +``save()`` method, as there's no general notion of what it means to delete a +form. + Adding additional fields to a formset ------------------------------------- @@ -559,8 +566,8 @@ If you manually render fields in the template, you can render </form> -Similarly, if the formset has the ability to order (``can_order=True``), it is possible to render it -with ``{{ form.ORDER }}``. +Similarly, if the formset has the ability to order (``can_order=True``), it is +possible to render it with ``{{ form.ORDER }}``. Using more than one formset in a view ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
