coaster
coaster copied to clipboard
StateManagerWrapper.group() doesn't include conditional states
Ideally it should.
IMO, group
should accept a list of desired states and test each item against that state. That way states defined in the model don't leak into UI when they're only meant for backend use.
Perhaps you can do this in Funnel as a one-off solution? There is no way to refer to a state object at the moment as Model.state.STATE
will return a SQL expression (#181), so it's unclear how group
will accept state as a parameter.
Cheap hack you could use for now:
buckets = {}
for proposal in proposal_list:
for state in ['A', 'B', ...]:
if getattr(proposal.state, state):
buckets.setdefault(state, []).append (proposal)
This issue is blocked on #181.