【发布时间】:2015-03-14 23:34:48
【问题描述】:
我刚开始使用 Django,目前我正在研究模型中的方法。我的问题如下:如何从用户实例中排除用户列表?用这个方法:
def get_other_users(self):
all = User.objects.all()
return User.objects.exclude(self.get_shift_users())
我收到错误:AttributeError: 'User' object has no attribute 'split'
get_shift_users 的代码:
@property
def get_shift_users(self):
return User.objects.filter(assign__shift=self)
【问题讨论】:
标签: python django django-models