pretalx-webhooks 2026.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. pretalx_webhooks-2026.2.1/LICENSE +201 -0
  2. pretalx_webhooks-2026.2.1/MANIFEST.in +10 -0
  3. pretalx_webhooks-2026.2.1/PKG-INFO +103 -0
  4. pretalx_webhooks-2026.2.1/README.rst +77 -0
  5. pretalx_webhooks-2026.2.1/justfile +79 -0
  6. pretalx_webhooks-2026.2.1/pretalx_webhooks/__init__.py +1 -0
  7. pretalx_webhooks-2026.2.1/pretalx_webhooks/apps.py +23 -0
  8. pretalx_webhooks-2026.2.1/pretalx_webhooks/forms.py +99 -0
  9. pretalx_webhooks-2026.2.1/pretalx_webhooks/locale/de_DE/LC_MESSAGES/django.po +78 -0
  10. pretalx_webhooks-2026.2.1/pretalx_webhooks/migrations/0001_initial.py +60 -0
  11. pretalx_webhooks-2026.2.1/pretalx_webhooks/migrations/__init__.py +0 -0
  12. pretalx_webhooks-2026.2.1/pretalx_webhooks/models.py +27 -0
  13. pretalx_webhooks-2026.2.1/pretalx_webhooks/payload.py +44 -0
  14. pretalx_webhooks-2026.2.1/pretalx_webhooks/signals.py +87 -0
  15. pretalx_webhooks-2026.2.1/pretalx_webhooks/static/pretalx_webhooks/settings.css +5 -0
  16. pretalx_webhooks-2026.2.1/pretalx_webhooks/templates/pretalx_webhooks/settings.html +31 -0
  17. pretalx_webhooks-2026.2.1/pretalx_webhooks/templates/pretalx_webhooks/webhook.html +66 -0
  18. pretalx_webhooks-2026.2.1/pretalx_webhooks/urls.py +16 -0
  19. pretalx_webhooks-2026.2.1/pretalx_webhooks/views.py +108 -0
  20. pretalx_webhooks-2026.2.1/pretalx_webhooks.egg-info/PKG-INFO +103 -0
  21. pretalx_webhooks-2026.2.1/pretalx_webhooks.egg-info/SOURCES.txt +26 -0
  22. pretalx_webhooks-2026.2.1/pretalx_webhooks.egg-info/dependency_links.txt +1 -0
  23. pretalx_webhooks-2026.2.1/pretalx_webhooks.egg-info/entry_points.txt +2 -0
  24. pretalx_webhooks-2026.2.1/pretalx_webhooks.egg-info/requires.txt +11 -0
  25. pretalx_webhooks-2026.2.1/pretalx_webhooks.egg-info/top_level.txt +1 -0
  26. pretalx_webhooks-2026.2.1/pyproject.toml +134 -0
  27. pretalx_webhooks-2026.2.1/setup.cfg +4 -0
  28. pretalx_webhooks-2026.2.1/uv.lock +2180 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Florian Moesch
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,10 @@
1
+ include LICENSE
2
+ include README.rst
3
+ include justfile
4
+ include pyproject.toml
5
+ include uv.lock
6
+ prune tests
7
+ recursive-include pretalx_webhooks *.py
8
+ recursive-include pretalx_webhooks/locale *.mo *.po
9
+ recursive-include pretalx_webhooks/static *
10
+ recursive-include pretalx_webhooks/templates *
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.4
2
+ Name: pretalx-webhooks
3
+ Version: 2026.2.1
4
+ Summary: Call a webhook for selected pretalx event activity.
5
+ Author-email: Florian Mösch <florian@moesch.org>
6
+ Maintainer-email: Florian Mösch <florian@moesch.org>
7
+ License-Expression: Apache-2.0
8
+ Project-URL: homepage, https://github.com/badbadc0ffee/pretalx-webhooks
9
+ Project-URL: repository, https://github.com/badbadc0ffee/pretalx-webhooks.git
10
+ Project-URL: issues, https://github.com/badbadc0ffee/pretalx-webhooks/issues
11
+ Keywords: pretalx
12
+ Requires-Python: >=3.13
13
+ Description-Content-Type: text/x-rst
14
+ License-File: LICENSE
15
+ Provides-Extra: dev
16
+ Requires-Dist: pretalx[dev]; extra == "dev"
17
+ Requires-Dist: build; extra == "dev"
18
+ Requires-Dist: check-manifest; extra == "dev"
19
+ Requires-Dist: djangofmt; extra == "dev"
20
+ Requires-Dist: twine; extra == "dev"
21
+ Requires-Dist: pytest; extra == "dev"
22
+ Requires-Dist: pytest-cov; extra == "dev"
23
+ Requires-Dist: pytest-django; extra == "dev"
24
+ Requires-Dist: ruff; extra == "dev"
25
+ Dynamic: license-file
26
+
27
+ pretalx-webhooks
28
+ ================
29
+
30
+ .. image:: https://img.shields.io/pypi/v/pretalx-webhooks.svg
31
+ :target: https://pypi.org/project/pretalx-webhooks/
32
+ :alt: PyPI version
33
+
34
+ .. image:: https://github.com/badbadc0ffee/pretalx-webhooks/actions/workflows/tests.yml/badge.svg
35
+ :target: https://github.com/badbadc0ffee/pretalx-webhooks/actions/workflows/tests.yml
36
+ :alt: Tests
37
+
38
+ ``pretalx-webhooks`` sends HTTP requests for selected pretalx activity log
39
+ entries. Each event can use multiple webhooks.
40
+
41
+ Installation
42
+ ------------
43
+
44
+ Install the plugin in the same Python environment as pretalx::
45
+
46
+ python -m pip install pretalx-webhooks
47
+ python -m pretalx migrate
48
+
49
+ Restart pretalx. In the organiser area, open **Settings → Plugins** and enable
50
+ the plugin for the event.
51
+
52
+ Configuration
53
+ -------------
54
+
55
+ Open **Settings → Webhook** in the event settings. The page lists all webhooks
56
+ for the event.
57
+
58
+ Select **Add webhook** to create a webhook. Then configure these fields:
59
+
60
+ * **Action**: The activity log entry that sends the webhook.
61
+ * **URL**: An HTTP or HTTPS target. An empty URL disables the webhook.
62
+ * **Method**: ``GET``, ``POST``, or ``PUT``.
63
+ * **Payload**: The request body for ``POST`` and ``PUT``.
64
+ * **HTTP Header**: Optional request header names and values.
65
+
66
+ Select a webhook in the list to edit or delete it.
67
+
68
+ Payload
69
+ -------
70
+
71
+ ``GET`` does not send a request body. ``POST`` and ``PUT`` send the payload as
72
+ UTF-8 text. A valid JSON payload uses ``application/json``. Other payloads use
73
+ ``text/plain`` unless a custom ``Content-Type`` header is present.
74
+
75
+ The payload supports pretalx event mail placeholders. For example::
76
+
77
+ {"event": "{event_slug}"}
78
+
79
+ JSON object braces do not need escaping. The configuration page shows an error
80
+ for an unknown placeholder.
81
+
82
+ pretalx writes failed requests and non-success HTTP responses to its log.
83
+
84
+ Development
85
+ -----------
86
+
87
+ Install `uv`_ and `just`_. Then run the checks::
88
+
89
+ just fmt-check
90
+ just test
91
+
92
+ Use ``just install-pretalx-local /path/to/pretalx`` to test with a local pretalx
93
+ checkout.
94
+
95
+ License
96
+ -------
97
+
98
+ Copyright 2026 Florian Mösch
99
+
100
+ Released under the terms of the Apache License 2.0
101
+
102
+ .. _just: https://just.systems/
103
+ .. _uv: https://docs.astral.sh/uv/
@@ -0,0 +1,77 @@
1
+ pretalx-webhooks
2
+ ================
3
+
4
+ .. image:: https://img.shields.io/pypi/v/pretalx-webhooks.svg
5
+ :target: https://pypi.org/project/pretalx-webhooks/
6
+ :alt: PyPI version
7
+
8
+ .. image:: https://github.com/badbadc0ffee/pretalx-webhooks/actions/workflows/tests.yml/badge.svg
9
+ :target: https://github.com/badbadc0ffee/pretalx-webhooks/actions/workflows/tests.yml
10
+ :alt: Tests
11
+
12
+ ``pretalx-webhooks`` sends HTTP requests for selected pretalx activity log
13
+ entries. Each event can use multiple webhooks.
14
+
15
+ Installation
16
+ ------------
17
+
18
+ Install the plugin in the same Python environment as pretalx::
19
+
20
+ python -m pip install pretalx-webhooks
21
+ python -m pretalx migrate
22
+
23
+ Restart pretalx. In the organiser area, open **Settings → Plugins** and enable
24
+ the plugin for the event.
25
+
26
+ Configuration
27
+ -------------
28
+
29
+ Open **Settings → Webhook** in the event settings. The page lists all webhooks
30
+ for the event.
31
+
32
+ Select **Add webhook** to create a webhook. Then configure these fields:
33
+
34
+ * **Action**: The activity log entry that sends the webhook.
35
+ * **URL**: An HTTP or HTTPS target. An empty URL disables the webhook.
36
+ * **Method**: ``GET``, ``POST``, or ``PUT``.
37
+ * **Payload**: The request body for ``POST`` and ``PUT``.
38
+ * **HTTP Header**: Optional request header names and values.
39
+
40
+ Select a webhook in the list to edit or delete it.
41
+
42
+ Payload
43
+ -------
44
+
45
+ ``GET`` does not send a request body. ``POST`` and ``PUT`` send the payload as
46
+ UTF-8 text. A valid JSON payload uses ``application/json``. Other payloads use
47
+ ``text/plain`` unless a custom ``Content-Type`` header is present.
48
+
49
+ The payload supports pretalx event mail placeholders. For example::
50
+
51
+ {"event": "{event_slug}"}
52
+
53
+ JSON object braces do not need escaping. The configuration page shows an error
54
+ for an unknown placeholder.
55
+
56
+ pretalx writes failed requests and non-success HTTP responses to its log.
57
+
58
+ Development
59
+ -----------
60
+
61
+ Install `uv`_ and `just`_. Then run the checks::
62
+
63
+ just fmt-check
64
+ just test
65
+
66
+ Use ``just install-pretalx-local /path/to/pretalx`` to test with a local pretalx
67
+ checkout.
68
+
69
+ License
70
+ -------
71
+
72
+ Copyright 2026 Florian Mösch
73
+
74
+ Released under the terms of the Apache License 2.0
75
+
76
+ .. _just: https://just.systems/
77
+ .. _uv: https://docs.astral.sh/uv/
@@ -0,0 +1,79 @@
1
+ set shell := ["bash", "-euo", "pipefail", "-c"]
2
+ set quiet
3
+ set fallback
4
+ set positional-arguments
5
+
6
+ uv_dev := "uv run --extra=dev"
7
+
8
+ # Run ruff format
9
+ [group('linting')]
10
+ format *args=".":
11
+ {{ uv_dev }} ruff format "$@"
12
+
13
+ # Run ruff check
14
+ [group('linting')]
15
+ check *args=".":
16
+ {{ uv_dev }} ruff check "$@"
17
+
18
+ # Format Django templates with djangofmt.
19
+ [group('linting')]
20
+ djangofmt *args="":
21
+ -{{ uv_dev }} djangofmt {{ args }} .
22
+
23
+ [group('linting')]
24
+ djangofmt-check:
25
+ just djangofmt
26
+ git diff --exit-code -- '*.html' || (echo "HTML templates are not formatted. Run 'just djangofmt' to fix." && exit 1)
27
+
28
+ # Check that VCS files and the sdist match (CI runs this)
29
+ [group('linting')]
30
+ check-manifest:
31
+ uv run --no-project --with check-manifest check-manifest
32
+
33
+ # Run all formatters and linters
34
+ [group('linting')]
35
+ fmt: (check "--fix") format djangofmt && fmt-done
36
+
37
+ [private]
38
+ fmt-done:
39
+ echo '{{ GREEN }}Formatting complete{{ NORMAL }}'
40
+
41
+ # Run all code quality checks
42
+ [group('linting')]
43
+ fmt-check: (format "--check") check djangofmt-check && check-done
44
+
45
+ [private]
46
+ check-done:
47
+ echo '{{ GREEN }}All checks passed{{ NORMAL }}'
48
+
49
+ # Run tests (installs pretalx if not already present)
50
+ [group('tests')]
51
+ test *args: ensure-pretalx
52
+ {{ uv_dev }} pytest "$@"
53
+
54
+ # Install development dependencies
55
+ [group('development')]
56
+ install-pretalx:
57
+ uv sync --extra=dev
58
+
59
+ # Install a local editable copy of pretalx (for development)
60
+ [group('development')]
61
+ install-pretalx-local path:
62
+ uv pip install -e "{{ path }}[dev]"
63
+
64
+ # Ensure pretalx is importable, installing it from git if needed
65
+ [private]
66
+ ensure-pretalx:
67
+ {{ uv_dev }} python -c "import pretalx" 2>/dev/null || just install-pretalx
68
+
69
+ # Generate locale files
70
+ [group('development')]
71
+ [script('bash')]
72
+ localegen: ensure-pretalx
73
+ module=$(find . -maxdepth 1 -type d -name 'pretalx_*' -not -name '*.egg-info' | head -1)
74
+ {{ uv_dev }} django-admin makemessages --add-location file -i build -i dist -i "*egg*" $(find "$module/locale/" -mindepth 1 -maxdepth 1 -type d -printf "-l %f " 2>/dev/null)
75
+
76
+ # Compile locale files
77
+ [group('development')]
78
+ localecompile: ensure-pretalx
79
+ {{ uv_dev }} django-admin compilemessages
@@ -0,0 +1 @@
1
+ __version__ = "2026.2.1"
@@ -0,0 +1,23 @@
1
+ from django.apps import AppConfig
2
+ from django.utils.translation import gettext_lazy
3
+
4
+ from . import __version__
5
+
6
+
7
+ class PluginApp(AppConfig):
8
+ name = "pretalx_webhooks"
9
+ verbose_name = "pretalx Webhooks"
10
+
11
+ class PretalxPluginMeta:
12
+ name = "pretalx Webhooks"
13
+ author = "Florian Mösch"
14
+ description = gettext_lazy("Call a webhook for selected event activity.")
15
+ visible = True
16
+ version = __version__
17
+ category = "FEATURE"
18
+ settings_links = [
19
+ (gettext_lazy("Settings"), "plugins:pretalx_webhooks:settings", {})
20
+ ]
21
+
22
+ def ready(self):
23
+ from . import signals # noqa: PLC0415, F401
@@ -0,0 +1,99 @@
1
+ from django import forms
2
+ from django.core.exceptions import ValidationError
3
+ from django.core.validators import RegexValidator
4
+ from django.forms import inlineformset_factory
5
+ from django.utils.translation import gettext_lazy as _
6
+
7
+ from pretalx.common.log import ACTION_TYPE_GROUPS, LOG_ALIASES, LOG_NAMES
8
+
9
+ from .models import WebhookHeader, WebhookSettings
10
+ from .payload import build_request, render_payload
11
+
12
+ LEGACY_ACTION_TYPES = {*LOG_ALIASES, "pretalx.submission.deleted"}
13
+ ACTION_TYPE_CHOICES = tuple(
14
+ (
15
+ group,
16
+ tuple(
17
+ (action_type, LOG_NAMES.get(action_type, label))
18
+ for action_type, label in actions
19
+ if action_type not in LEGACY_ACTION_TYPES
20
+ ),
21
+ )
22
+ for group, actions in ACTION_TYPE_GROUPS.items()
23
+ )
24
+
25
+
26
+ class WebhookHeaderForm(forms.ModelForm):
27
+ name = forms.CharField(
28
+ label=_("Header"),
29
+ max_length=255,
30
+ widget=forms.TextInput(attrs={"placeholder": _("Header")}),
31
+ validators=[
32
+ RegexValidator(
33
+ regex=r"^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$",
34
+ message=_("Enter a valid HTTP header name."),
35
+ )
36
+ ],
37
+ )
38
+ value = forms.CharField(
39
+ label=_("Value"),
40
+ required=False,
41
+ strip=False,
42
+ widget=forms.TextInput(attrs={"placeholder": _("Value")}),
43
+ validators=[
44
+ RegexValidator(
45
+ regex=r"^[^\r\n]*$", message=_("Enter a valid HTTP header value.")
46
+ )
47
+ ],
48
+ )
49
+
50
+ class Meta:
51
+ model = WebhookHeader
52
+ fields = ("name", "value")
53
+
54
+
55
+ WebhookHeaderFormSet = inlineformset_factory(
56
+ WebhookSettings, WebhookHeader, form=WebhookHeaderForm, extra=1, can_delete=True
57
+ )
58
+
59
+
60
+ class WebhookSettingsForm(forms.ModelForm):
61
+ action_type = forms.ChoiceField(
62
+ choices=ACTION_TYPE_CHOICES,
63
+ initial="pretalx.schedule.release",
64
+ label=_("Action"),
65
+ widget=forms.Select(),
66
+ )
67
+
68
+ def __init__(self, *args, event=None, **kwargs):
69
+ if event and "instance" not in kwargs:
70
+ kwargs["instance"] = WebhookSettings.objects.filter(
71
+ event=event
72
+ ).first() or WebhookSettings(event=event)
73
+ super().__init__(*args, **kwargs)
74
+ self.fields["payload"].strip = False
75
+
76
+ def clean(self):
77
+ data = super().clean()
78
+ if not self.errors and data["url"]:
79
+ try:
80
+ payload = render_payload(data["payload"], self.instance.event)
81
+ build_request(data["url"], data["method"], payload)
82
+ except ValidationError as error:
83
+ self.add_error(None, error)
84
+ return data
85
+
86
+ class Meta:
87
+ model = WebhookSettings
88
+ fields = ("action_type", "url", "method", "payload")
89
+ help_texts = {
90
+ "url": _("Use an HTTP or HTTPS URL. Leave empty to disable the hook."),
91
+ "payload": _(
92
+ "GET ignores the payload. POST and PUT send this text as the body. "
93
+ "Event mail placeholders such as {event_slug} are supported."
94
+ ),
95
+ }
96
+ widgets = {
97
+ "url": forms.URLInput(attrs={"autocomplete": "off"}),
98
+ "payload": forms.Textarea(attrs={"rows": 5}),
99
+ }
@@ -0,0 +1,78 @@
1
+ # German translations for pretalx-webhooks.
2
+ # Copyright (C) 2026 Florian Mösch
3
+ # This file is distributed under the same license as pretalx-webhooks.
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: pretalx-webhooks\n"
7
+ "Report-Msgid-Bugs-To: \n"
8
+ "POT-Creation-Date: 2026-11-12 00:05+0100\n"
9
+ "PO-Revision-Date: 2026-11-11 17:02+0100\n"
10
+ "Last-Translator: Florian Mösch <florian@moesch.org>\n"
11
+ "Language-Team: German\n"
12
+ "Language: de_DE\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: 8bit\n"
16
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
+
18
+ #: pretalx_webhooks/apps.py
19
+ msgid "Call a webhook for selected event activity."
20
+ msgstr "Rufe einen Webhook für ausgewählte Event-Aktivitäten auf."
21
+
22
+ #: pretalx_webhooks/forms.py
23
+ msgid "Enter a valid HTTP header name."
24
+ msgstr "Gib einen gültigen HTTP-Header-Namen ein."
25
+
26
+ #: pretalx_webhooks/forms.py pretalx_webhooks/models.py
27
+ msgid "Value"
28
+ msgstr "Wert"
29
+
30
+ #: pretalx_webhooks/forms.py
31
+ msgid "Enter a valid HTTP header value."
32
+ msgstr "Gib einen gültigen HTTP-Header-Wert ein."
33
+
34
+ #: pretalx_webhooks/forms.py
35
+ msgid "Use an HTTP or HTTPS URL. Leave empty to disable the hook."
36
+ msgstr ""
37
+ "Verwende eine HTTP- oder HTTPS-URL. Lasse das Feld leer, um den Hook zu "
38
+ "deaktivieren."
39
+
40
+ #: pretalx_webhooks/forms.py
41
+ #, python-brace-format
42
+ msgid ""
43
+ "GET ignores the payload. POST and PUT send this text as the body. Event mail "
44
+ "placeholders such as {event_slug} are supported."
45
+ msgstr ""
46
+ "GET ignoriert die Nutzdaten. POST und PUT senden diesen Text als Body. "
47
+ "Platzhalter aus E-Mail-Vorlagen wie {event_slug} werden unterstützt."
48
+
49
+ #: pretalx_webhooks/models.py
50
+ msgid "Payload"
51
+ msgstr "Nutzdaten"
52
+
53
+ #: pretalx_webhooks/payload.py
54
+ msgid "Select GET, POST, or PUT."
55
+ msgstr "Wähle GET, POST oder PUT aus."
56
+
57
+ #: pretalx_webhooks/signals.py
58
+ #: pretalx_webhooks/templates/pretalx_webhooks/settings.html
59
+ msgid "Webhook"
60
+ msgstr "Webhook"
61
+
62
+ #: pretalx_webhooks/templates/pretalx_webhooks/settings.html
63
+ msgid "HTTP Header"
64
+ msgstr "HTTP-Header"
65
+
66
+ #: pretalx_webhooks/templates/pretalx_webhooks/settings.html
67
+ msgid "New webhook"
68
+ msgstr "Neuer Webhook"
69
+
70
+ #: pretalx_webhooks/views.py
71
+ msgid "Webhook settings saved."
72
+ msgstr "Webhook-Einstellungen gespeichert."
73
+
74
+ #: pretalx_webhooks/views.py
75
+ #, python-brace-format
76
+ msgid "Rendered payload: {payload}"
77
+ msgstr "Gerenderte Nutzdaten: {payload}"
78
+