Skip to content

Instantly share code, notes, and snippets.

@mikeywaites
Last active November 29, 2017 12:50
Show Gist options
  • Save mikeywaites/4287b14ab0fc1b5cff2b8ca72c8e653e to your computer and use it in GitHub Desktop.
Save mikeywaites/4287b14ab0fc1b5cff2b8ca72c8e653e to your computer and use it in GitHub Desktop.
from flask import g
class UserCharacterLikesIndexEndpoint(KimEndpoint, DBListMixin, DBCreateMixin):
url = '/<string:obj_id>/likes'
name = 'likes'
many = True
mapper_class = UserCharacterLikeMapper
model = UserCharacterLike
def save_object(self, obj):
character = self.get_character_obj()
obj.character_id = character.id
obj.user_id = g.user.id
return super(UserCharacterLikesIndexEndpoint, self).save_object(obj)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment