Skip to content

Commit d65c4b2

Browse files
committed
use AddSiblingActivator in docs instead of add_label
1 parent 451a4aa commit d65c4b2

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

docs/source/collection-fields.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ the collection is used to glue them together.
7171
:caption: forms.py
7272

7373
from django.forms import fields, forms
74-
from formset.collection import FormCollection
74+
from formset.collection import AddSiblingActivator, FormCollection
7575
from formset.formfields.collection import CollectionField
7676
from formset.formfields.richtext import RichTextField
7777
from formset.forms import ModelForm
@@ -95,13 +95,14 @@ the collection is used to glue them together.
9595

9696
class SlideCollection(FormCollection):
9797
legend = "Carousel Slides"
98-
add_label = "Add Slide"
9998
min_siblings = 1
10099
max_siblings = 10
101100
is_sortable = True
102101
slide_form = SlideForm()
102+
induce_add_sibling = '.add_slide:active'
103103
ignore_marked_for_removal = True
104-
104+
add_slide = AddSiblingActivator("Add Slide")
105+
105106
class CarouselForm(ModelForm):
106107
auto_start = fields.BooleanField(
107108
label="Auto Start",
@@ -193,9 +194,10 @@ stored. We therefore can map the field named ``context`` directly onto the equal
193194
extra_siblings = 0
194195
accordion_item = AccordionItem()
195196
legend = "Accordion"
196-
add_label = "Add Accordion Item"
197+
induce_add_sibling = '.add_accordion_item:active'
197198
ignore_marked_for_removal = True
198-
199+
add_accordion_item = AddSiblingActivator("Add Accordion Item")
200+
199201
class AccordionForm(ModelForm):
200202
context = CollectionField(AccordionCollection)
201203

formset/collection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def __new__(cls, name, bases, attrs):
6262
"'add_label' is deprected in {module}.{name}. Use 'induce_add_sibling' and a "
6363
"detached 'AddSiblingActivator' instead.".format(module=attrs.get('__module__'), name=name),
6464
PendingDeprecationWarning,
65+
stacklevel=2,
6566
)
6667
attrs.setdefault('induce_add_sibling', '.add_sibling:active')
6768
attrs.setdefault('add_sibling', AddSiblingActivator(add_label))

0 commit comments

Comments
 (0)