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

Add column header setting #80

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

liamdiprose
Copy link

This PR adds the ability to define the CSV column order from within the code
Currently, the CSV Parser assumes the first row of CSV data contains the column names.

This PR adds the ability to define the column names from the ViewSet class:

class CSVEndpoint(viewsets.ModelViewSet):
    serializer_class = CSVSerializer
    parser_classes = (CSVParser,)

    csv_header = ("time", "temperature")

There are still a few small things I would like to address before this is merged. Namely

  • Is the viewset class the appropriate place to define the csv_header variable?
  • Testing? I've only manually-tested this with my own project so far.
  • Code style, this is quick and dirty; is there more django-y way of doing this?

Thanks

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

Successfully merging this pull request may close these issues.

None yet

1 participant