Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
对于 Django 中的自定义查询,我几乎没有什么要求
Person.objects.raw('SELECT id, first_name, last_name, birth_date FROM Person A inner join Address B on A.address = B.id ')
or B.id = A.address_id
您需要在原始查询中使用数据库的表和字段名称——您提供的字符串将被传递给数据库,而不是由 Django ORM 解释。
我在输出中有这个警告,但它没有作为“问题”出现(我目前没有问题)。但是在我的输出中我得到:
Warning: Attempt to present <DeviceDetailViewController: 0x84a7340