【发布时间】:2026-02-18 23:00:01
【问题描述】:
是否可以通过一些额外/单一版本的字段名称来过滤模型?
例如,使用类似模型(其中authors 是CharField,其中包含python-list,例如['Johnny']):
class Movie(models.Model):
title = models.CharField(max_length=100, null=False, blank=False)
actors = models.CharField(max_length=250, null=True, blank=True)
并查询类似Movie.objects.filter(input) 的内容,其中输入为<QueryDict: {'actor': ["['Johnny']", "['Pablo']"]}>
有人知道怎么解决吗?
提前致谢。
【问题讨论】:
标签: django django-models django-rest-framework django-orm