我已經延長通過AUTH_PROFILE_MODULE
User
到包括ManyToMany
場項目用戶參與。反向查詢擴展的用戶簡
我想扭轉的關係,並獲得與特定項目相關的用戶。
我的用戶有配置文件(我已成功地將它們返回related_projects = u.profile.projects
)。
related_users = project.userprofile_set.all()
正在給我東西 - {% for user in related_users %} {{ user }} {% endfor %}
收益率User Profile for: richlyon
。但我不能讓{{ user }}
產生任何領域。我試過{{ user.username }}
。
問題:我正在以這種錯誤的方式進行?如果我不是,我如何從擴展的用戶配置文件中的反向關係中獲取字段信息?
非常感謝您的時間。
...並感謝您的解釋和解決方案 - 這完美的作品。 – Richard