【发布时间】:2014-07-07 09:07:52
【问题描述】:
我想从我的项目中排除非活跃用户。
example 1:
url:users/1/friends/ will show all friends of that user.
我只想在好友列表中显示活跃用户。
example 2:
url:users/1/friends/ will show all friends of that user.
如果 id 为 1 的用户不活跃,我不想显示他的任何活动..喜欢他的朋友..他的个人资料...等等
example 3:
url:users/1/challenge/ will show all friends of that user in post form.
我不想在表单中显示非活跃用户。
是否有任何通用的方法来执行此操作。因为它是一个大项目,我不能到处做过滤器。
表格如下:
class User(models.Model):
......
......
friends = models.ForeignKey(User)
【问题讨论】:
标签: django python-2.7 django-rest-framework