Changes from parent to many childs #335
-
I have a parent that makes a few database queries. Everything is working good, and doing this I only have to do a single query to the database, and not for every component. But the problem is I cannot update the childs when the parent is updated. I see is more normal to update the parent from the child in the docs, but I cannot figure how to do this updates when a change occurs in the parent. What is the correct way to update more than one child when changes ocurrs in the parent? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
In the for child in self.children:
if hasattr(child, "is_editing"):
child.is_editing = False Something similar to that is how I've handled changing a child from a parent. Child components can sometimes be tricky to get working, but hopefully that is helpful! |
Beta Was this translation helpful? Give feedback.
In the
table.py
section of https://www.django-unicorn.com/docs/child-components/#multiple-children there is this code:Something similar to that is how I've handled changing a child from a parent.
Child components can sometimes be tricky to get working, but hopefully that is helpful!