Conversation
|
Hi @cpina Thanks for all your effort on this topic. I don't have the headspace today to think about this all fully, but thought I could make some progress on this PR. If I understand the issue correctly we're getting strange behavior when two groups are named the same. That is two groups open / close when you click one item. This comment here suggests that we shouldn't allow two groups to be named the same and we should instead raise an error? If so, why would we merge an incorrect layout to master? I'm really happy to take a working layout here, as I think we're missing accordions at the moment https://github.com/django-crispy-forms/django-crispy-forms/pull/1099/files#r544494764 |
I understand - it required some proper headscape for me to do it! But when got all the pieces in the head (Accordion, AccordionGroup, rendering steps) it's a logic solution.
This pull request for The enforcing of the unique name happens (already happened, this is old code not related to these PRs) here: The fix is in: django-crispy-forms/django-crispy-forms@a12e9ba : it assigns the What's not possible is to re-use the same instance of an But if I had done: accordion_group_1 = AccordionGroup('Accordion Group 1', 'text_input_accordion1')
accordion_group_2 = AccordionGroup('Accordion Group 2', 'text_input_accordion2')
helper = FormHelper()
helper.layout = Layout(
Accordion(accordion_group_1, accordion_group_2),
HTML('<strong>Second accordion:</strong>'),
Accordion('accordion_group1, accordion_group_2),)above code doesn't work. When I was testing it I realised that |
No description provided.