1
我試圖過濾顯示的列表,當我在許多領域使用lupe(圖像波紋管)。 也許文本搜索也會很有趣。如何自定義django管理員搜索結果在很多領域
任何幫助?
下面的代碼:
class PresentialModuleCourseInline(NestedStackedInline):
"""Module Course Presential Stacked Inline"""
model = Course.modules.through
raw_id_fields = ('module_course',)
extra = 1
def get_queryset(self, request):
return self.model.objects.filter(
module_course__type_course=ModuleCourse.PRESENTIAL) # Doesn't work
哪有我在NestedStackedInline中使用它? –
它不依賴於'NestedStackedInline'。如果您爲「課程」管理頁面設置了「search_fields」,它也會顯示在[此屏幕]上(https://i.stack.imgur.com/w3Sjn.png) –
你沒事。唯一的限制是爲此視圖設置查詢集,但對於篩選器和搜索,這也適用。謝謝! –