Merge branch 'master' into dependabot/pip/pyparsing-3.2.3

This commit is contained in:
Juro Oravec 2025-04-07 21:36:21 +02:00 committed by GitHub
commit 225f45d0b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 8 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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