Payment/Manual: Add more ID placeholders

This commit is contained in:
Adrian Moennich 2022-03-16 12:52:36 +01:00
parent 7fb07eb5f3
commit 378a127a5f
4 changed files with 28 additions and 3 deletions

View File

@ -8,6 +8,10 @@ integration with Indico.
## Changelog
### 3.1
- Add placeholders for the registration form id and the registration's database id
### 3.0
- Initial release for Indico 3.0

View File

@ -55,6 +55,24 @@ class RegistrationIDPlaceholder(IDPlaceholder):
name = 'registration_id'
class RegistrationDatabaseIDPlaceholder(Placeholder):
name = 'registration_db_id'
description = _("The database ID of the registration")
@classmethod
def render(cls, regform, registration):
return registration.id
class RegistrationFormIDPlaceholder(Placeholder):
name = 'registration_form_id'
description = _("The ID of the registration form")
@classmethod
def render(cls, regform, registration):
return registration.registration_form.id
class EventIDPlaceholder(Placeholder):
name = 'event_id'
description = _("The ID of the event")

View File

@ -64,11 +64,14 @@ class ManualPaymentPlugin(PaymentPluginMixin, IndicoPlugin):
def _get_details_placeholders(self, sender, regform, registration, **kwargs):
from indico_payment_manual.placeholders import (CurrencyPlaceholder, EmailPlaceholder, EventIDPlaceholder,
FirstNamePlaceholder, LastNamePlaceholder, PricePlaceholder,
RegistrationIDPlaceholder)
RegistrationDatabaseIDPlaceholder,
RegistrationFormIDPlaceholder, RegistrationIDPlaceholder)
yield FirstNamePlaceholder
yield LastNamePlaceholder
yield EmailPlaceholder
yield RegistrationIDPlaceholder
yield RegistrationDatabaseIDPlaceholder
yield RegistrationFormIDPlaceholder
yield EventIDPlaceholder
yield PricePlaceholder
yield CurrencyPlaceholder

View File

@ -1,6 +1,6 @@
[metadata]
name = indico-plugin-payment-manual
version = 3.0
version = 3.1
description = Payment plugin for Indico that can be used for custom payment information/links
long_description = file: README.md
long_description_content_type = text/markdown; charset=UTF-8; variant=GFM
@ -20,7 +20,7 @@ zip_safe = false
include_package_data = true
python_requires = ~=3.9.0
install_requires =
indico>=3.0
indico>=3.1
[options.entry_points]
indico.plugins =