class FriendshipManager(models.Manager):
def are_friends(self, user1, user2):
if self.filter(from_user=user1, to_user=user2).count() > 0:
return True
if self.filter(from_user=user2, to_user=user1).count() > 0:
return True
return False
and i found count() so i try it, but it runs wrong
a=[1,2,3,4]
print a.count()
or
a='ssada'
print a.count()
why my code run wrong,but the FriendshipManager can run ,thanks Please try to use the code, rather than text, because my English is not very good, thank you