mirror of
https://github.com/django-components/django-components.git
synced 2025-08-09 00:37:59 +00:00
feat: add Media.extend (#890)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
5e8770c720
commit
ab037f24b0
7 changed files with 727 additions and 61 deletions
|
@ -490,6 +490,9 @@ class Component(
|
|||
This path is still rendered to HTML with `media_class.render_js()` or `media_class.render_css()`.
|
||||
- A `SafeString` (with `__html__` method) is considered an already-formatted HTML tag, skipping both static file
|
||||
resolution and rendering with `media_class.render_js()` or `media_class.render_css()`.
|
||||
- You can set [`extend`](../api#django_components.ComponentMediaInput.extend) to configure
|
||||
whether to inherit JS / CSS from parent components. See
|
||||
[Controlling Media Inheritance](../../concepts/fundamentals/defining_js_css_html_files/#controlling-media-inheritance).
|
||||
|
||||
However, there's a few differences from Django's Media class:
|
||||
|
||||
|
@ -498,8 +501,6 @@ class Component(
|
|||
2. Individual JS / CSS files can be any of `str`, `bytes`, `Path`,
|
||||
[`SafeString`](https://dev.to/doridoro/django-safestring-afj), or a function
|
||||
(See [`ComponentMediaInputPath`](../api#django_components.ComponentMediaInputPath)).
|
||||
3. Our Media class does NOT support
|
||||
[Django's `extend` keyword](https://docs.djangoproject.com/en/5.1/topics/forms/media/#extend)
|
||||
|
||||
**Example:**
|
||||
|
||||
|
@ -518,7 +519,7 @@ class Component(
|
|||
"print": ["path/to/style2.css"],
|
||||
}
|
||||
```
|
||||
"""
|
||||
""" # noqa: E501
|
||||
|
||||
response_class = HttpResponse
|
||||
"""This allows to configure what class is used to generate response from `render_to_response`"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue