Использую django-jet для админки
В чем может быть проблема?
Поле регистрация
models.py
registration = models.CharField(_('registration'), max_length=255)
forms.py
class ConditionAdminForm(forms.ModelForm): REGISTRATION_CHOICES= ( ('Any', _('Any')), ('Constant', _('Constant')), ('Temporary', _('Temporary')), ) registration = forms.MultipleChoiceField(choices = REGISTRATION_CHOICES, label=_("registration form")) def clean_registration(self): registration = self.cleaned_data['registration'] if not registration: raise forms.ValidationError("...") registration = ', '.join(registration) return registration class Meta: model = Condition fields = '__all__'
admin.py
class ConditionInlineAdmin(admin.StackedInline): model = Condition form = ConditionAdminForm
отрендеренный admin html
<div class="form-row field-registration"> <div> <label class="required" for="id_condition_set-0-registration">registration:</label> <select multiple="" id="id_condition_set-0-registration" name="condition_set-0-registration" tabindex="-1" class="select2-hidden-accessible" aria-hidden="true"> <option value="Any">Any</option> <option value="Constant">Constant</option> <option value="Temporary">Temporary</option> </select> <span class="select2 select2-container select2-container--jet" dir="ltr" style="width: auto;"> <span class="selection"> <span class="select2-selection select2-selection--multiple" role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" tabindex="0"> <ul class="select2-selection__rendered"> <li class="select2-search select2-search--inline"> <input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" placeholder="" style="width: 0.75em;"> </li> </ul> </span> </span> <span class="dropdown-wrapper" aria-hidden="true"></span> </span> </div> </div>