Skip to content

fix: use correct query param key for format in feeds_advanced#953

Merged
regulartim merged 3 commits intoGreedyBear-Project:developfrom
Sanchit2662:fix/feeds-advanced-format-param
Mar 5, 2026
Merged

fix: use correct query param key for format in feeds_advanced#953
regulartim merged 3 commits intoGreedyBear-Project:developfrom
Sanchit2662:fix/feeds-advanced-format-param

Conversation

@Sanchit2662
Copy link
Copy Markdown
Contributor

@Sanchit2662 Sanchit2662 commented Mar 4, 2026

Description

I noticed that the feeds_advanced endpoint silently ignores the format query parameter — it always returns JSON no matter what you pass. The issue was a simple key mismatch: FeedRequestParams.init was reading format_ (with an underscore) from the query dict instead of format. This worked fine for the legacy feeds view since it explicitly injected the key as format_, but feeds_advanced passes request.query_params directly — so a user's ?format=csv was never picked up and it just fell back to json. I fixed it by changing the lookup key to format in both places and updated the docstring to match.

closes #949

Type of change

  • [ x] Bug fix (non-breaking change which fixes an issue).

Checklist

Formalities

  • [ x] I have read and understood the rules about how to Contribute to this project.
  • [ x] I chose an appropriate title for the pull request in the form: <feature name>. Closes #999
  • [ x] My branch is based on develop.
  • [ x] The pull request is for the branch develop.
  • [ x] I have reviewed and verified any LLM-generated code included in this PR.

Docs and tests

  • [ x] I documented my code changes with docstrings and/or comments.
  • [ x] I have checked if my changes affect user-facing behavior that is described in the docs. If so, I also created a pull request in the docs repository.
  • [ x] Linter (Ruff) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.
  • [ x] I have added tests for the feature/bug I solved.
  • [ x] All the tests gave 0 errors.

Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>
@Sanchit2662
Copy link
Copy Markdown
Contributor Author

Hi @regulartim , please review the changes

@regulartim
Copy link
Copy Markdown
Collaborator

Hey @Sanchit2662 !

[ x] I have added tests for the feature/bug I solved.

No you did not! Why did you check the box?

@Sanchit2662
Copy link
Copy Markdown
Contributor Author

Sanchit2662 commented Mar 4, 2026

You're right @regulartim , that's completely my mistake I shouldn't have checked that box when I hadn't actually written any tests. Sorry about that. Do you want me to add a test for the format query parameter now and then update the checklist honestly.

@regulartim
Copy link
Copy Markdown
Collaborator

You're right @regulartim , that's completely my mistake I shouldn't have checked that box when I hadn't actually written any tests. Sorry about that.

No worries, but please be a little more thorough next time.

Do you want me to add a test for the format query parameter now and then update the checklist honestly.

Yes, I think adding a test case is the right thing to do here. It should be a test that fails without your changes but passes with your fix in place.

Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>
Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>
@Sanchit2662
Copy link
Copy Markdown
Contributor Author

@regulartim , added the test case.

Copy link
Copy Markdown
Collaborator

@regulartim regulartim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you! :)

@regulartim regulartim merged commit ed245e3 into GreedyBear-Project:develop Mar 5, 2026
4 checks passed
cclts pushed a commit to cclts/GreedyBear that referenced this pull request Mar 11, 2026
…Bear-Project#953)

* fix: use correct query param key for format in feeds_advanced

Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>

* test: add tests for format query param in feeds_advanced

Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>

* fix: disable DRF format query param override to avoid 404 on ?format=csv

Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>

---------

Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>
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.

2 participants