2π
β
This would work:
{% exclude_files_by_type Site.sitefiles_set.all "Site Plan, Cabinet Photo" as files %}
and your assignment tag:
@register.assignment_tag
def exclude_files_by_type(SiteFiles, types):
type_list = [type.strip() for type in types.split(',')]
return SiteFiles.exclude(file_type__type__in=type_list)
To add more types to the exclusion query you should place them in the argument separated by commas:
{% exclude_files_by_type Site.sitefiles_set.all "Site Plan, Cabinet Photo, Last Summer, Group Selfies" as files %}
π€Moses Koledoye
Source:stackexchange.com