We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello everyone,
Is it supported to use Autocomplete widget in FieldBlock?
Autocomplete
FieldBlock
I have successfully created it but am not sure if is supported, recommended or best practice.
Code:
class CountryAutocomplete(Autocomplete): target_model = Country can_create = False is_single = False class CountriesBlock(FieldBlock): def __init__(self, required=True, help_text=None, **kwargs): self.field = forms.ModelMultipleChoiceField( Country.objects.all(), widget=CountryAutocomplete ) super().__init__(**kwargs) def get_prep_value(self, value): if value is None: return None return [obj.pk for obj in value] class VideoBlock(StructBlock): countries = CountriesBlock("countries")
If it is, maybe it would be good idea add example to documentation.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello everyone,
Is it supported to use
Autocomplete
widget inFieldBlock
?I have successfully created it but am not sure if is supported, recommended or best practice.
Code:
If it is, maybe it would be good idea add example to documentation.
The text was updated successfully, but these errors were encountered: