mirror of
https://github.com/django-components/django-components.git
synced 2025-09-04 13:10:30 +00:00
Merge branch 'master' into dependabot/pip/pyparsing-3.2.3
This commit is contained in:
commit
225f45d0b8
4 changed files with 24 additions and 8 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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue