def get_liked(user_or_id, model):
 obj_type = apps.get_model('contenttypes', 'ContentType').objects.get_for_model(model)
 conditions = ('likes_like.content_type_id = %s', ('%s.id = likes_like.object_id' % model._meta.db_table), 'likes_like.user_id = %s')
 if isinstance(user_or_id, get_user_model()):
  user_id = user_or_id.id
 else:
  user_id = user_or_id
 return model.objects.extra(where=conditions, tables=('likes_like',), params=(obj_type.id, user_id))

def get_liked ( user_or_id , model ) : obj_type = apps . get_model ( 'contenttypes' , 'ContentType' ) . objects . get_for_model ( model ) conditions = ( 'likes_like.content_type_id = %s' , ( '%s.id = likes_like.object_id' % model . _meta . db_table ) , 'likes_like.user_id = %s' ) if isinstance ( user_or_id , get_user_model ( ) ) : user_id = user_or_id . id else : user_id = user_or_id return model . objects . extra ( where = conditions , tables = ( 'likes_like' , ) , params = ( obj_type . id , user_id ) )
get the objects liked by an user .