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

Document data.header #73

Open
dmacnet opened this issue Feb 27, 2018 · 0 comments
Open

Document data.header #73

dmacnet opened this issue Feb 27, 2018 · 0 comments

Comments

@dmacnet
Copy link

dmacnet commented Feb 27, 2018

The Ordered Fields section of the documentation should mention this third method which is supported by the renderer:

        # Try to pull the header off of the data, if it's not passed in as an
        # argument.
        if not header and hasattr(data, 'header'):
            header = data.header

This can be accomplished by using a subclass of list:

class AttributeList(list):
    """A list which can have attributes added."""

alist = AttributeList(rows_list)
alist.header = column_names_list
return Response(alist)

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