mirror of
https://github.com/django-components/django-components.git
synced 2025-09-27 07:59:08 +00:00
Merge branch 'master' into dependabot/pip/mkdocs-material-9.6.11
This commit is contained in:
commit
625c1a4735
5 changed files with 28 additions and 12 deletions
12
README.md
12
README.md
|
@ -253,12 +253,17 @@ Read more about [HTML attributes](https://django-components.github.io/django-com
|
||||||
|
|
||||||
- Expose components as views with `get`, `post`, `put`, `patch`, `delete` methods
|
- Expose components as views with `get`, `post`, `put`, `patch`, `delete` methods
|
||||||
|
|
||||||
|
- Automatically create an endpoint for the component with `Component.Url.public`
|
||||||
|
|
||||||
```py
|
```py
|
||||||
# components/calendar/calendar.py
|
# components/calendar/calendar.py
|
||||||
@register("calendar")
|
@register("calendar")
|
||||||
class Calendar(Component):
|
class Calendar(Component):
|
||||||
template_file = "calendar.html"
|
template_file = "calendar.html"
|
||||||
|
|
||||||
|
class Url:
|
||||||
|
public = True
|
||||||
|
|
||||||
class View:
|
class View:
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
page = request.GET.get("page", 1)
|
page = request.GET.get("page", 1)
|
||||||
|
@ -274,8 +279,11 @@ class Calendar(Component):
|
||||||
"page": page,
|
"page": page,
|
||||||
}
|
}
|
||||||
|
|
||||||
# urls.py
|
# Get auto-generated URL for the component
|
||||||
path("calendar/", Calendar.as_view()),
|
url = get_component_url(Calendar)
|
||||||
|
|
||||||
|
# Or define explicit URL in urls.py
|
||||||
|
path("calendar/", Calendar.as_view())
|
||||||
```
|
```
|
||||||
|
|
||||||
### Type hints
|
### Type hints
|
||||||
|
|
|
@ -243,12 +243,17 @@ Read more about [HTML attributes](../../concepts/fundamentals/html_attributes/).
|
||||||
|
|
||||||
- Expose components as views with `get`, `post`, `put`, `patch`, `delete` methods
|
- Expose components as views with `get`, `post`, `put`, `patch`, `delete` methods
|
||||||
|
|
||||||
|
- Automatically create an endpoint for the component with `Component.Url.public`
|
||||||
|
|
||||||
```py
|
```py
|
||||||
# components/calendar/calendar.py
|
# components/calendar/calendar.py
|
||||||
@register("calendar")
|
@register("calendar")
|
||||||
class Calendar(Component):
|
class Calendar(Component):
|
||||||
template_file = "calendar.html"
|
template_file = "calendar.html"
|
||||||
|
|
||||||
|
class Url:
|
||||||
|
public = True
|
||||||
|
|
||||||
class View:
|
class View:
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
page = request.GET.get("page", 1)
|
page = request.GET.get("page", 1)
|
||||||
|
@ -264,8 +269,11 @@ class Calendar(Component):
|
||||||
"page": page,
|
"page": page,
|
||||||
}
|
}
|
||||||
|
|
||||||
# urls.py
|
# Get auto-generated URL for the component
|
||||||
path("calendar/", Calendar.as_view()),
|
url = get_component_url(Calendar)
|
||||||
|
|
||||||
|
# Or define explicit URL in urls.py
|
||||||
|
path("calendar/", Calendar.as_view())
|
||||||
```
|
```
|
||||||
|
|
||||||
### Type hints
|
### Type hints
|
||||||
|
|
|
@ -70,7 +70,7 @@ pytest==8.3.5
|
||||||
# pytest-django
|
# pytest-django
|
||||||
pytest-asyncio==0.24.0
|
pytest-asyncio==0.24.0
|
||||||
# via -r requirements-ci.in
|
# via -r requirements-ci.in
|
||||||
pytest-django==4.10.0
|
pytest-django==4.11.1
|
||||||
# via -r requirements-ci.in
|
# via -r requirements-ci.in
|
||||||
pyyaml==6.0.2
|
pyyaml==6.0.2
|
||||||
# via asv
|
# via asv
|
||||||
|
|
|
@ -40,7 +40,7 @@ filelock==3.16.1
|
||||||
# via
|
# via
|
||||||
# tox
|
# tox
|
||||||
# virtualenv
|
# virtualenv
|
||||||
flake8==7.1.2
|
flake8==7.2.0
|
||||||
# via
|
# via
|
||||||
# -r requirements-dev.in
|
# -r requirements-dev.in
|
||||||
# flake8-pyproject
|
# flake8-pyproject
|
||||||
|
@ -94,11 +94,11 @@ pluggy==1.5.0
|
||||||
# tox
|
# tox
|
||||||
pre-commit==4.2.0
|
pre-commit==4.2.0
|
||||||
# via -r requirements-dev.in
|
# via -r requirements-dev.in
|
||||||
pycodestyle==2.12.1
|
pycodestyle==2.13.0
|
||||||
# via flake8
|
# via flake8
|
||||||
pyee==12.0.0
|
pyee==12.0.0
|
||||||
# via playwright
|
# via playwright
|
||||||
pyflakes==3.2.0
|
pyflakes==3.3.2
|
||||||
# via flake8
|
# via flake8
|
||||||
pygments==2.19.1
|
pygments==2.19.1
|
||||||
# via
|
# via
|
||||||
|
@ -120,7 +120,7 @@ pytest==8.3.5
|
||||||
# syrupy
|
# syrupy
|
||||||
pytest-asyncio==0.24.0
|
pytest-asyncio==0.24.0
|
||||||
# via -r requirements-dev.in
|
# via -r requirements-dev.in
|
||||||
pytest-django==4.10.0
|
pytest-django==4.11.1
|
||||||
# via -r requirements-dev.in
|
# via -r requirements-dev.in
|
||||||
pyyaml==6.0.2
|
pyyaml==6.0.2
|
||||||
# via
|
# via
|
||||||
|
|
|
@ -68,7 +68,7 @@ gitdb==4.0.12
|
||||||
# via gitpython
|
# via gitpython
|
||||||
gitpython==3.1.44
|
gitpython==3.1.44
|
||||||
# via mkdocs-git-revision-date-localized-plugin
|
# via mkdocs-git-revision-date-localized-plugin
|
||||||
griffe==1.7.1
|
griffe==1.7.2
|
||||||
# via mkdocstrings-python
|
# via mkdocstrings-python
|
||||||
htmlmin2==0.1.13
|
htmlmin2==0.1.13
|
||||||
# via mkdocs-minify-plugin
|
# via mkdocs-minify-plugin
|
||||||
|
@ -152,7 +152,7 @@ mkdocstrings==0.29.1
|
||||||
# via
|
# via
|
||||||
# hatch.envs.docs
|
# hatch.envs.docs
|
||||||
# mkdocstrings-python
|
# mkdocstrings-python
|
||||||
mkdocstrings-python==1.16.8
|
mkdocstrings-python==1.16.10
|
||||||
# via hatch.envs.docs
|
# via hatch.envs.docs
|
||||||
mypy-extensions==1.0.0
|
mypy-extensions==1.0.0
|
||||||
# via black
|
# via black
|
||||||
|
@ -189,7 +189,7 @@ pymdown-extensions==10.14.3
|
||||||
# markdown-exec
|
# markdown-exec
|
||||||
# mkdocs-material
|
# mkdocs-material
|
||||||
# mkdocstrings
|
# mkdocstrings
|
||||||
pyparsing==3.2.2
|
pyparsing==3.2.3
|
||||||
# via mike
|
# via mike
|
||||||
python-dateutil==2.9.0.post0
|
python-dateutil==2.9.0.post0
|
||||||
# via ghp-import
|
# via ghp-import
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue