mirror of
https://github.com/django-components/django-components.git
synced 2025-08-04 14:28:18 +00:00
parent
7e74831599
commit
2499126d1f
4 changed files with 14 additions and 3 deletions
|
@ -12,11 +12,15 @@
|
|||
# settings.py
|
||||
COMPONENTS = {
|
||||
"extensions": [
|
||||
"djc_ext_pydantic.PydanticExtension",
|
||||
"djc_pydantic.PydanticExtension",
|
||||
],
|
||||
}
|
||||
```
|
||||
|
||||
#### Fix
|
||||
|
||||
- Make it possible to resolve URLs added by extensions by their names
|
||||
|
||||
## v0.135
|
||||
|
||||
#### Feat
|
||||
|
|
|
@ -193,7 +193,7 @@ And add the extension to your project:
|
|||
```py
|
||||
COMPONENTS = {
|
||||
"extensions": [
|
||||
"djc_ext_pydantic.PydanticExtension",
|
||||
"djc_pydantic.PydanticExtension",
|
||||
],
|
||||
}
|
||||
```
|
||||
|
|
|
@ -3,7 +3,7 @@ from typing import TYPE_CHECKING, Any, Callable, Dict, List, NamedTuple, Tuple,
|
|||
|
||||
import django.urls
|
||||
from django.template import Context
|
||||
from django.urls import URLResolver
|
||||
from django.urls import URLResolver, get_resolver, get_urlconf
|
||||
|
||||
from django_components.app_settings import app_settings
|
||||
from django_components.compat.django import routes_to_django
|
||||
|
@ -634,6 +634,11 @@ class ExtensionManager:
|
|||
ext_url_resolver.urlconf_name = urls
|
||||
ext_url_resolver.url_patterns = urls
|
||||
|
||||
# Rebuild URL resolver cache to be able to resolve the new routes by their names.
|
||||
urlconf = get_urlconf()
|
||||
resolver = get_resolver(urlconf)
|
||||
resolver._populate()
|
||||
|
||||
def get_extension(self, name: str) -> ComponentExtension:
|
||||
for extension in self.extensions:
|
||||
if extension.name == name:
|
||||
|
|
|
@ -75,6 +75,8 @@ COMPONENTS = {
|
|||
"dirs": [Path(__file__).resolve().parent / "components"],
|
||||
}
|
||||
|
||||
urlpatterns: list = []
|
||||
|
||||
|
||||
class StaticFilesFinderTests(SimpleTestCase):
|
||||
@djc_test(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue