Найти - Пользователи
Полная версия: Кастомное отображение пустого ForeignKey
Начало » Django » Кастомное отображение пустого ForeignKey
1
darvin11
Есть модель, в ней поле somefield = models.ForeignKey(SomeField, blank=True, null=True)
Как сделать, чтобы в админках, когда somefield==None, отображалось не “——-”, а некий текст?
Lolka
http://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.ModelChoiceField.empty_label
field1 = forms.ModelChoiceField(queryset=..., empty_label="(Nothing)")
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB