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

Draft: Add warning async is not supported #1911

Closed
wants to merge 3 commits into from

Conversation

denisSurkov
Copy link

Description

Add warning async is not supported.

Fixes #1845

Checklist:

  • I have added the relevant tests for this change.
  • I have added an item to the Pending section of docs/changes.rst.

@denisSurkov denisSurkov changed the title Add warning async is not supported Draft; Add warning async is not supported May 1, 2024
@denisSurkov denisSurkov changed the title Draft; Add warning async is not supported Draft: Add warning async is not supported May 1, 2024
@@ -792,3 +794,46 @@ def test_ajax_refresh(self):
)
self.assertNotIn("/ajax/", history_panel.text)
self.assertIn("/json_view/", history_panel.text)


Copy link
Contributor

@cclauss cclauss Jul 6, 2024

Choose a reason for hiding this comment

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

Suggested change
from django.test import AsyncRequestFactory

https://docs.djangoproject.com/en/stable/topics/testing/advanced/#asyncrequestfactory

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for the tip

Copy link
Contributor

@cclauss cclauss Jul 6, 2024

Choose a reason for hiding this comment

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

You must move that line up near the top of the file with the other imports.

Modify line 16 to read from django.test import AsyncRequestFactory, RequestFactory

@denisSurkov
Copy link
Author

As far as I see the problem would become irrelevant soon, after #1933

If so, feel free to close this PR

try:
from django.test import AsyncRequestFactory
except ImportError:
AsyncRequestFactory = None
Copy link
Contributor

Choose a reason for hiding this comment

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

AsyncRequestFactory is defined in Django >= v3.1 so the ImportError should not happen on all supported versions of Django.

Just modify line 16 to read from django.test import AsyncRequestFactory, RequestFactory

@tim-schilling
Copy link
Contributor

Sorry @denisSurkov as you mentioned #1938 should make this work unnecessary. It should be merged in the next few weeks so I think we can put this to rest for the time being. I appreciate your help and desire to make the toolbar a better library!

If you're looking to contribute, there are several things that could be improved. If you're async focused, #1938 has identified several panels that are async incompatible (Panel.is_async = False) that need further investigation.

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.

Document that the toolbar does not support async functionality
3 participants