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
Goal If you simplify, I need Select2 with such parameters at the exit:
$("#id_contact_person").select2({ placeholder: "select person", allowClear: true, language: { noResults: function() { return " <button style="width: 100%" type="button" class="btn btn-primary" onClick=ajaxAddPersonr()'Save new person</button> </li>" } }, escapeMarkup: function (markup) { return markup; } })
Problem
`class ClientOrderAdminForm(forms.ModelForm): def init(self, *args, **kwargs): super().init(*args, **kwargs) self.fields['person'].widget.can_view_related = False self.fields['person'].widget.can_add_related = False self.fields['incoming_phone'].widget.can_add_related = False self.fields['incoming_phone'].widget.can_view_related = False
address = forms.ModelChoiceField( queryset=PersonAddress.objects.all(), label="Адрес доставки", required=False, widget=ModelSelect2Widget( model=PersonAddress, search_fields=('settlement__description_ua__icontains', 'settlement__description_ua__icontains'), dependent_fields={'person': 'person'}, attrs={'data-placeholder': 'выберите адрес доставки контрагента', 'style': 'width: 80%;', 'data-minimum-input-length': '0'} ) ) contact_person = forms.ModelChoiceField( queryset=ContactPersonShotStr.objects.all(), label="Контактное лицо", required=False, widget=ModelSelect2Widget( model=ContactPersonShotStr, search_fields=('full_name__icontains', 'phone__number__contains'), dependent_fields={'person': 'person'}, attrs={ 'data-placeholder': 'выберите контактное лицо', 'data-allow-clear': True, # doesn't work 'data-language': json.dumps({"noResults": format_html('<span>Some HTML</span>')}, indent=4), # doesn't work 'style': 'width: 80%;', 'data-minimum-input-length': '0', } ) )`
Code Snippet Please provide a code snippet of your problem.
The text was updated successfully, but these errors were encountered:
sory $('#id_delivery_phone').djangoSelect2({ language: {noResults: () => '111'}, });
$('#id_delivery_phone').djangoSelect2({ language: {noResults: () => '111'}, });
Sorry, something went wrong.
No branches or pull requests
Goal
If you simplify, I need Select2 with such parameters at the exit:
$("#id_contact_person").select2({ placeholder: "select person", allowClear: true, language: { noResults: function() { return " <button style="width: 100%" type="button" class="btn btn-primary" onClick=ajaxAddPersonr()'Save new person</button> </li>" } }, escapeMarkup: function (markup) { return markup; } })
Problem
`class ClientOrderAdminForm(forms.ModelForm):
def init(self, *args, **kwargs):
super().init(*args, **kwargs)
self.fields['person'].widget.can_view_related = False
self.fields['person'].widget.can_add_related = False
self.fields['incoming_phone'].widget.can_add_related = False
self.fields['incoming_phone'].widget.can_view_related = False
Code Snippet
Please provide a code snippet of your problem.
The text was updated successfully, but these errors were encountered: