Add ability to export filtered QuerySet of FilterView to JSON format#1572
Conversation
62b3ddb to
169c023
Compare
|
@aayushkdev The implementation looks fine but we need a few unit tests before merging. |
|
Hey, thanks for the review. I have exams going on right now, so I'll add the unit tests as soon as they're finished. |
d8142a5 to
e5e45ea
Compare
|
Hey @tdruez, I have pushed the required unit tests. Could you please check if they are fit for merging |
There was a problem hiding this comment.
-
The ExportJSONMixin is used for all the object models but only the CodebaseResourceListView returns a valid response.
The code breaks if you try to export from any other list view, such as packages.
The tests are incomplete as those only test for the resource type. -
The returned JSON is not valid when multiple records are included. It seems that the comma is missing.
scanpipe/templates/scanpipe/dropdowns/list_actions_dropdown.html
Outdated
Show resolved
Hide resolved
f439105 to
d2b7497
Compare
|
Hey @tdruez I have pushed the required changes, please have a look. |
tdruez
left a comment
There was a problem hiding this comment.
@aayushkdev thanks for the changes, we are getting closer but the JSON output is still invalid. See the comment for suggestions.
Also on a more general note: avoid tempering with the git history by merging all previous commits and force-pushing in the branch, this makes looking at the code diffs since the last review much harder.
All the commits will be merged into a single commit once the PR is done, no need to rewrite history during the developement phase.
|
Hey @tdruez I have made the required changes please have a look |
|
@aayushkdev Everything looks good! Could you add a simple entry in the CHANGELOG.rst file so I can merge the PR? |
1196f83 to
3b02bfe
Compare
done!! I have also rebased the commits into one |
…rView' into the JSON format, Solves issue aboutcode-org#1319 Signed-off-by: Aayush Kumar <[email protected]> made the implementation of ExportJSONMixin simpler by removing streaming of data and removed exclude_json_fields Signed-off-by: Aayush Kumar <[email protected]>
3b02bfe to
4be8585
Compare
@aayushkdev As mentioned earlier, you never need to do this, and should never force-push. It's valuable to keep the commit history. |
|
@aayushkdev Thanks for your contribution! But keep in mind, if you force-push, you are doing it wrong ;) |
Ah, I see - thanks for clarifying. I misunderstood and thought the final rebase was expected. I’ll make sure not to force-push or squash commits like this again. Appreciate the guidance! |
|
@aayushkdev No worries. Thanks for this super useful feature! |
fix #1319
Added the ability to export the current filtered QuerySet of a
FilterViewinto the JSON format.