drf-forms/drf-schema-adapter

override EmberAdapter extras['choices']

Closed this issue · 2 comments

How would I start customise values in extras['choices'] for the EmberAdapter?
Goal is to have filtered choices in OPTIONS for specific fields.

Just as an idea:

Filtering would be done with a custom FilterSet.
The label/values could be extracted via filter_set.qs.values_list(field_name, flat=True).

The best way would be to create a custom adapter the inherits from EmberAdapter.

You can find basic instructions on how to build a custom adapter in the docs: http://drf-schema-adapter.readthedocs.io/en/latest/drf_auto_endpoint/metadata/#creating-a-custom-adapter but it is likely that you'll have to dig into the code

As this is a question and it's been answered, I'm closing this issue. If the answer is not satisfactory, feel free to re-open