piccolo icon indicating copy to clipboard operation
piccolo copied to clipboard

Feature request: support for dynamic choices

Open scott2b opened this issue 3 years ago • 3 comments

Since choices takes an enum rather than a callable, it is not clear how one would provide choices dynamically. It would be ideal if we could provide dynamic choices so that, for example, the choices themselves could be stored in a table.

scott2b avatar May 24 '22 01:05 scott2b

Hmmm... how does Django and other ORMs handle this

cheesycod avatar Oct 03 '22 05:10 cheesycod

We could let the user pass in a function.

It does introduce some challenges though. For example, we have to make sure Piccolo Admin keeps refetching the table schema just in case the choices have changed.

Also, would the function return a list of potential values, or an Enum.

dantownsend avatar Oct 03 '22 19:10 dantownsend

maybe a dict of key: value's

cheesycod avatar Oct 12 '22 17:10 cheesycod