select fields with list import
possibility to import a list or copy/paste a list instead of creating each option 1 by 1. Would help on fields like the "Country" selection.
This is a really cool idea :)
I think .csv would be best.
Agreed, I missed that feature few times. Specifically for a country field I also have a snippet, I think it would make sense to try to add it to the package.
class CountryFormField(Field):
name = _("Country Field")
allow_children = False
form_field = CountryField().formfield
form_field_widget = CountrySelectWidget
form_field_enabled_options = []
fieldset_general_fields = []
fieldset_advanced_fields = []
def get_form_field_widget_kwargs(self, instance):
return {
'layout': '{widget}',
}
def get_form_field_kwargs(self, instance: Field) -> dict:
kwargs = super().get_form_field_kwargs(instance)
kwargs['label'] = ''
return kwargs
plugin_pool.register_plugin(CountryFormField)
Is this possible entirely within the scope of a field plugin (without changing code on the form class itself)? If yes, would it be recommendable to create such functionality in a separate repo / package?
It's definitely possible, but after adding that snippet to ~5 projects over half a year it becomes apparent to me that it's more suitable for this repository :)