【发布时间】:2021-12-01 20:32:57
【问题描述】:
所以我有一个 json 数据,其中包含模型的字段名称作为带有值的 json 键。我想在运行时运行 orm 查询并定义字段名称。
例如:
json_data = {"postgres_id":"10"}
query = AcronymSecurityControlMaster.objects.get(postgres_id=10)
json_data = {"age":"10"}
query = AcronymSecurityControlMaster.objects.get(age=10)
【问题讨论】:
标签: python django django-models django-rest-framework django-orm