-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,31 @@ | ||
# Register your receivers here | ||
from django.dispatch import receiver | ||
|
||
from pretix.base.signals import register_text_placeholders | ||
from pretix.base.email import BaseMailTextPlaceholder | ||
|
||
class AttendeeEmailPlaceholder(BaseMailTextPlaceholder): | ||
def __init__(self): | ||
self._identifier = "attendee_email" | ||
|
||
@property | ||
def required_context(self): | ||
return ["order", "position"] | ||
|
||
@property | ||
def identifier(self): | ||
return self._identifier | ||
|
||
def render(self, context): | ||
position = context["position"] | ||
# TODO: print statement for sanity check -- remove | ||
print(f"attendee_email: {position.attendee_email}") | ||
return position.attendee_email | ||
|
||
def render_sample(self, context): | ||
return "[email protected]" | ||
|
||
|
||
@receiver(register_text_placeholders, dispatch_uid="placeholder_custom") | ||
def register_placeholder_renderers(sender, **kwargs): | ||
return AttendeeEmailPlaceholder() |