Guest User

Untitled

a guest
Nov 22nd, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. from arrested import Resource
  2. from arrested.contrib.kim_arrested import KimEndpoint
  3. from arrested.contrib.sql_alchemy import DBListMixin
  4.  
  5. from star_wars.models import db, Character
  6. from .mappers import CharacterMapper
  7.  
  8. characters_resource = Resource('characters', __name__, url_prefix='/characters')
  9.  
  10.  
  11. class CharactersIndexEndpoint(KimEndpoint, DBListMixin):
  12.  
  13. name = 'list'
  14. many = True
  15. mapper_class = CharacterMapper
  16. model = Character
  17.  
  18. def get_query(self):
  19.  
  20. stmt = db.session.query(Character)
  21. return stmt
  22.  
  23. characters_resource.add_endpoint(CharactersIndexEndpoint)
Add Comment
Please, Sign In to add comment