mirror of
https://github.com/django-components/django-components.git
synced 2025-09-19 12:19:44 +00:00
refactor: fix link in docs + call django.setup() in @djc_test if not done so (#1098)
This commit is contained in:
parent
bb5de86b69
commit
9f9b1f7232
3 changed files with 9 additions and 1 deletions
|
@ -35,6 +35,8 @@
|
|||
|
||||
Read more on [Component views and URLs](https://django-components.github.io/django-components/0.135/concepts/fundamentals/component_views_urls/).
|
||||
|
||||
- `@djc_test` can now be called without first calling `django.setup()`, in which case it does it for you.
|
||||
|
||||
#### Deprecation
|
||||
|
||||
- Currently, view request handlers such as `get()` and `post()` methods can be defined
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<img src="https://raw.githubusercontent.com/django-components/django-components/master/logo/logo-black-on-white.svg" alt="django-components" style="max-width: 100%; background: white; color: black;">
|
||||
|
||||
[](https://pypi.org/project/django-components/) [](https://pypi.org/project/django-components/) [](https://github.com/django-components/django-components/blob/master/LICENSE/) [](https://pypistats.org/packages/django-components) [](https://github.com/django-components/django-components/actions/workflows/tests.yml) [](/django-components/benchmarks/)
|
||||
[](https://pypi.org/project/django-components/) [](https://pypi.org/project/django-components/) [](https://github.com/django-components/django-components/blob/master/LICENSE/) [](https://pypistats.org/packages/django-components) [](https://github.com/django-components/django-components/actions/workflows/tests.yml) [](/django-components/latest/benchmarks/)
|
||||
|
||||
`django-components` combines Django's templating system with the modularity seen
|
||||
in modern frontend frameworks like Vue or React.
|
||||
|
|
|
@ -6,6 +6,7 @@ from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Set,
|
|||
from unittest.mock import patch
|
||||
from weakref import ReferenceType
|
||||
|
||||
import django
|
||||
from django.conf import settings as _django_settings
|
||||
from django.template import engines
|
||||
from django.test import override_settings
|
||||
|
@ -296,6 +297,11 @@ def djc_test(
|
|||
|
||||
# Contents of this function will run as the test
|
||||
def _wrapper_impl(*args: Any, **kwargs: Any) -> Any:
|
||||
# If Django is not yet configured, do so now, because we'll need to access
|
||||
# Django's settings when merging the given settings.
|
||||
if not _django_settings.configured:
|
||||
django.setup()
|
||||
|
||||
# Merge the settings
|
||||
current_django_settings = django_settings if not callable(django_settings) else None
|
||||
current_django_settings = current_django_settings.copy() if current_django_settings else {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue