0

Добрый день, пытаюсь вывести в админке django поле с ManytoMany, точнее сортировать это поле

так вот

class CasinoForm(forms.ModelForm):
class Meta():
    model = Casino
    fields = ['meta_title','meta_description','meta_keywords','title','logo','mini_logo','background','e_wallet','credit_cards','bank_send','e_partomone','pending_period','raiting_total','raiting_admin','external_href','description','support','description_bonus','payment','valuta','games','langs','license','country','sport','rtp']

country = forms.MultipleChoiceField(choices=CasinoCountries.objects.all().values_list('id', 'name_ru').order_by('name_ru'))

Делаю выборку по алфавиту Стран, в админке отображается, сохраняет, но не выводит в списке сохраненные(не выводит отмеченные в мультиselecte), помогите пожалуйста

1 ответ 1

0
class CasinoForm(forms.ModelForm):
    country = forms.MultipleChoiceField(queryset=CasinoCountries.objects.all().values_list('id', 'name_ru').order_by('name_ru'))
    class Meta():
        model = Casino
        fields = ['meta_title','meta_description','meta_keywords','title','logo','mini_logo','background','e_wallet','credit_cards','bank_send','e_partomone','pending_period','raiting_total','raiting_admin','external_href','description','support','description_bonus','payment','valuta','games','langs','license','country','sport','rtp']

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.