def subscribe_to_creator(user_id, creator_id):
 subscribers_model_creator = user_models.UserSubscribersModel.get(creator_id, strict=False)
 subscriptions_model_user = user_models.UserSubscriptionsModel.get(user_id, strict=False)
 if (not subscribers_model_creator):
  subscribers_model_creator = user_models.UserSubscribersModel(id=creator_id)
 if (not subscriptions_model_user):
  subscriptions_model_user = user_models.UserSubscriptionsModel(id=user_id)
 if (user_id not in subscribers_model_creator.subscriber_ids):
  subscribers_model_creator.subscriber_ids.append(user_id)
  subscriptions_model_user.creator_ids.append(creator_id)
  subscribers_model_creator.put()
  subscriptions_model_user.put()

def subscribe_to_creator ( user_id , creator_id ) : subscribers_model_creator = user_models . UserSubscribersModel . get ( creator_id , strict = False ) subscriptions_model_user = user_models . UserSubscriptionsModel . get ( user_id , strict = False ) if ( not subscribers_model_creator ) : subscribers_model_creator = user_models . UserSubscribersModel ( id = creator_id ) if ( not subscriptions_model_user ) : subscriptions_model_user = user_models . UserSubscriptionsModel ( id = user_id ) if ( user_id not in subscribers_model_creator . subscriber_ids ) : subscribers_model_creator . subscriber_ids . append ( user_id ) subscriptions_model_user . creator_ids . append ( creator_id ) subscribers_model_creator . put ( ) subscriptions_model_user . put ( )
subscribes a user to a creator .