forked from openedx-unsupported/edx-analytics-data-api
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
429 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
LEARNER_API_DEFAULT_LIST_PAGE_SIZE = 25 | ||
|
||
SEGMENTS = ["highly_engaged", "disengaging", "struggling", "inactive", "unenrolled"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
""" | ||
API renderers common to all versions of the API. | ||
""" | ||
from rest_framework_csv.renderers import CSVRenderer | ||
|
||
|
||
class PaginatedCsvRenderer(CSVRenderer): | ||
""" | ||
Render CSV data using just the results array. | ||
Use with PaginatedHeadersMixin to preserve the pagination links in the response header. | ||
""" | ||
results_field = 'results' | ||
media_type = 'text/csv' | ||
|
||
def render(self, data, *args, **kwargs): | ||
""" | ||
Replace the rendered data with just what is in the results_field. | ||
""" | ||
if not isinstance(data, list): | ||
data = data.get(self.results_field, []) | ||
return super(PaginatedCsvRenderer, self).render(data, *args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.