Skip to content

Commit fccade9

Browse files
committed
added nested rows and columns
1 parent 81690b3 commit fccade9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

app/models/layout.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,26 @@ def get_feeds(self, columns: Column) -> list[Feed]:
107107

108108
return feeds
109109

110+
def process_rows(self, column: Column) -> list[Feed]:
111+
"""Recursively walk a column's rows/columns/widgets and return any feed widgets.
112+
113+
This helper complements get_feeds where nested structures can contain rows
114+
that in turn contain more columns. It returns a flat list of Feed objects.
115+
"""
116+
feeds: list[Feed] = []
117+
# If this column contains nested rows, descend into them
118+
if getattr(column, "rows", None):
119+
for row in column.rows:
120+
for col in row.columns:
121+
feeds += self.process_rows(col)
122+
123+
# Collect feed widgets from this column
124+
for widget in getattr(column, "widgets", []):
125+
if getattr(widget, "type", None) == "feed":
126+
feeds.append(widget)
127+
128+
return feeds
129+
110130
def get_feed(self, feed_id: str) -> Feed:
111131
if not self.feed_hash:
112132
feeds = []

0 commit comments

Comments
 (0)