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

Migrate to django-ninja #745

Merged
merged 31 commits into from
Aug 23, 2023
Merged

Migrate to django-ninja #745

merged 31 commits into from
Aug 23, 2023

Conversation

danlamanna
Copy link
Member

@zachmullen zachmullen force-pushed the isic-143-ninja-migration branch 2 times, most recently from 9a7a402 to a4e6929 Compare August 16, 2023 17:55
This is essentially a direct port of DRF's cursor-based pagination impl to django-ninja.
@zachmullen
Copy link
Collaborator

@danlamanna the tests are now passing; this is probably a good time to do a mid-stream code review to make sure the changes I made are reasonable.

f"/api/v2/collections/{collection.pk}/populate-from-search/", {"query": "sex:male"}
f"/api/v2/collections/{collection.pk}/populate-from-search/",
{"query": "sex:male"},
content_type="application/json",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we ok with having to add this to every test request with a JSON body, or should we make our own subclass of Django's test Client?

Copy link
Collaborator

Choose a reason for hiding this comment

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

A: We should use ninja.testing.TestClient

Copy link
Collaborator

@zachmullen zachmullen Aug 17, 2023

Choose a reason for hiding this comment

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

FWIW I think using the django.test.Client is preferable until this issue is resolved.

We were already checking for other permissions on them before taking action, but we should also make sure the user can see them first.
@zachmullen zachmullen force-pushed the isic-143-ninja-migration branch 2 times, most recently from 4c556b3 to cd231d2 Compare August 19, 2023 01:01
@zachmullen zachmullen force-pushed the isic-143-ninja-migration branch 2 times, most recently from f80bf94 to 81c996c Compare August 21, 2023 01:02
@zachmullen
Copy link
Collaborator

This is now ready for final review. All references to DRF have been removed from this codebase. Here's a comparison of the old and new swagger pages:

Screenshot 2023-08-22 at 3 33 53 PM Screenshot 2023-08-22 at 3 35 04 PM

These are very sweeping changes, so there's a high likelihood that some behavioral changes have slipped through the cracks. If you have a good way to manually verify zip downloading end-to-end, that would be good, as I have not done so locally.

@zachmullen zachmullen marked this pull request as ready for review August 22, 2023 19:42
Copy link
Member Author

@danlamanna danlamanna left a comment

Choose a reason for hiding this comment

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

This looks awesome! Reviewing this PR reminded me of how big our API surface is, so thanks for slogging through it all. Zip download works well on my end.

isic/core/api/collection.py Show resolved Hide resolved
isic/core/api/image.py Outdated Show resolved Hide resolved
isic/core/api/image.py Show resolved Hide resolved
isic/core/api/image.py Outdated Show resolved Hide resolved
isic/core/templates/ninja/swagger.html Outdated Show resolved Hide resolved
isic/core/pagination.py Show resolved Hide resolved
isic/core/templates/ninja/swagger.html Outdated Show resolved Hide resolved
isic/core/templates/ninja/swagger.html Outdated Show resolved Hide resolved
isic/zip_download/api.py Outdated Show resolved Hide resolved
isic/zip_download/tests/test_zip_download.py Show resolved Hide resolved
@zachmullen
Copy link
Collaborator

I believe all feedback has been addressed, PTAL.

@danlamanna danlamanna merged commit cad89ff into master Aug 23, 2023
2 checks passed
@danlamanna danlamanna deleted the isic-143-ninja-migration branch August 23, 2023 18:11
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