Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of values on api.inherit doesn't appear #11

Open
joicy opened this issue Sep 12, 2020 · 0 comments
Open

List of values on api.inherit doesn't appear #11

joicy opened this issue Sep 12, 2020 · 0 comments

Comments

@joicy
Copy link

joicy commented Sep 12, 2020

Hi! I'm following this tutorial but I have a problem with the API pagination. Although the pagination data is appearing, the data fields don't. Do you have any idea what I can do?

My code:

flatdata_fields = api.model('Mutations', {
    'id': fields.Integer(readOnly=True),
    'mutation_code': fields.String(required=True),
    'pdb_mutant': fields.String,
    'pdbs_template': fields.String,
    'mutated_chain': fields.String,
    'mutation_type': fields.String,
    'mut_count': fields.Integer,
})
pagination = api.model('A page of results', {
    'total': fields.Integer(),
    'page': fields.Integer(),
    'per_page': fields.Integer(),
})

page_of_flatdata = api.inherit('Page of Mutation data', pagination, {
    'rows': fields.List(fields.Nested(flatdata_fields))
})
@td.route('/')
class rawThermDataList(Resource):
    @api.expect(pagination_arguments)
    @api.marshal_with(page_of_flatdata)
    def get(self):
        args = pagination_arguments.parse_args(request)
        page = args.get('page', 1)
        per_page = args.get('per_page', 10)
        return FlatData.query.paginate(page, per_page, error_out=False)

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant