Only iterating over the middle content_columns?


#1

Standard behavior for the list action is to use content_columns to get
all the fields of a model and then do something with them. I’d like to
ignore some of them and iteratre over the rest. For instance I may have
A B C D … X Y Z and I’d like to do something special with A and B and
then Y and Z, but in the middle I’d definitely like a loop to say
“Whatever else is in the middle, here.”

What’s my option there? content_columns (or column_names) just seems to
iterate over everything. I’m currently looking at maybe using “slice”
on the result but I haven’t gotten that to work syntactically, yet. Is
there a different way?

d


#2

Duane wrote:

Standard behavior for the list action is to use content_columns to get
all the fields of a model and then do something with them. I’d like to
ignore some of them and iteratre over the rest. For instance I may have
A B C D … X Y Z and I’d like to do something special with A and B and
then Y and Z, but in the middle I’d definitely like a loop to say
“Whatever else is in the middle, here.”

a,b = list[0…1]
y,z = list[-2…-1]
remainder = list[2…-3]

That sort of syntax should do it…