在多对多字段中使用AllValuesFilter
过滤LinkWidget
并通过All
显示此内容,我没有获得list_filter
过滤器选项,因为与django admin Page
。
我发现了django-filter以及其他各种相关问题,但我没有得到解决方案......
在这个特定情况下,我正在过滤Django Add Any & None Handling to ChoiceFilter (and subclasses) # models.py
# wagtail imports
# ...
# modelcluster imports, eg.
# from modelcluster.fields import ParentalKey, ParentalManyToManyField
class CategoryRegion(models.Model):
title = models.CharField(max_length=200,)
class NewsPage(Page):
categories_region = ParentalManyToManyField(
"core.CategoryRegion",
blank=True,
)
模型的类别:
# filters.py
import django_filters
from django_filters.widgets import LinkWidget
class NewsFilter(django_filters.FilterSet):
categories_region = django_filters.AllValuesFilter(
name="categories_region__title",
label="Categories: Region",
widget=LinkWidget(),
)
class Meta:
model = NewsPage
fields = ['categories_region',]
-
@echo off
setlocal EnableDelayedExpansion
rem Initialize "i" variable with the desired number of digits as zeros
set i=1000
rem Process the files in creation date-time order
for /F "delims=" %%a in ('dir /A-D /OD /B *.tif') do (
rem Increment the number: "1001"...
set /A i+=1
rem Omit first digit in number: "1", use the rest: "001"...
ren "%%a" "image(!i:~1!).tif"
)
任何提示?
答案 0 :(得分:2)