Skip to content

Draft: Add warning async is not supported - #1911

Closed
denisSurkov wants to merge 3 commits into
django-commons:mainfrom
denisSurkov:main
Closed

Draft: Add warning async is not supported#1911
denisSurkov wants to merge 3 commits into
django-commons:mainfrom
denisSurkov:main

Conversation

@denisSurkov

Copy link
Copy Markdown

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
Comment thread tests/test_integration.py
self.assertNotIn("/ajax/", history_panel.text)
self.assertIn("/json_view/", history_panel.text)


@cclauss cclauss Jul 6, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

@cclauss cclauss Jul 6, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Author

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

If so, feel free to close this PR

Comment thread tests/test_integration.py Outdated
try:
from django.test import AsyncRequestFactory
except ImportError:
AsyncRequestFactory = None

Copy link
Copy Markdown
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
Copy Markdown
Member

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