I have a set of objects stored in a variable called subs. The column subscribed_to is a foreign object.
Is there any way to do check if a related_object is in this list in a simpler way:
def check_subscription_status(user, related_object):
subs = get_user_subscriptions(user) # returns filter queryset
subscribed = False
for s in subs:
if s.subscribed_to == related_object: #related object is the potential match
subscribed = True
break
return subscribed
ETA: A better way: