【发布时间】:2010-02-25 20:21:25
【问题描述】:
我有一个 SQL 查询,它在我的基于 Django 的 web 应用程序的 Postgres 数据库上运行。该查询针对 Django-Notifications(可重用应用程序)存储的数据运行,并返回未选择退出特定通知类型的电子邮件地址列表。
我真正想做的是构建一个按需执行此操作的应用程序,因此我正在寻找一个如何转换 SQL 以便它可以在 Django 视图中运行的示例,该视图将传递出去格式化的电子邮件列表。 SQL 目前是这样的:
gr_webapp=# select email from emailconfirmation_emailaddress where verified and user_id not in
(select user_id from notification_noticesetting s join notification_noticetype t on s.notice_type_id = t.id
where t.label = 'announcement' and not s.send);
【问题讨论】:
标签: python sql django django-models