Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra context to template rendering #68

Closed
joshvillbrandt opened this issue Jul 19, 2019 · 1 comment
Closed

Add extra context to template rendering #68

joshvillbrandt opened this issue Jul 19, 2019 · 1 comment
Assignees

Comments

@joshvillbrandt
Copy link

Hi! Is there a way to pass extra context variables to the template rendering? This appears hard-coded after finding the rendering in the source.

Maybe a callable function defined in the settings could help generate a supplemental context. Specifically, I'm looking to pass in the front-end base URL for a logo image in the html templates.

Thanks!

@apragacz apragacz self-assigned this Oct 5, 2019
apragacz added a commit that referenced this issue Oct 5, 2019
Add VERIFICATION_TEMPLATE_CONTEXT_BUILDER settings key
@apragacz
Copy link
Owner

apragacz commented Oct 5, 2019

@joshvillbrandt
I added ‘VERIFICATION_TEMPLATE_CONTEXT_BUILDER’ settings key so the template context can be customized. The signature of the function looks as follows:

def build_default_template_context(
        user, user_address, data,
        notification_type=None, notification_method=None):
    ...

There is also more verbose description in the docs which you can find here:

https://django-rest-registration.readthedocs.io/en/latest/detailed_configuration/global_verification.html#verification-template-context-builder

This feature should be released in next version (0.5.2).

@apragacz apragacz closed this as completed Oct 5, 2019
apragacz added a commit that referenced this issue Oct 12, 2019
Changes:

*   Resolve issue #77: Allow using DRR without templates setup
*   Fix issue #79: do not create user when sending verification fails
*   Fix issue #83: Support change to already existing e-mail in the DB
    Detect whether user email field is unique. If yes, then send "e-mail
    already exists" notification instead of verification one.
    Also, perform a check just before changing the e-mail to avoid
    integrity errors.
*   Fix issue #68
    Add VERIFICATION_TEMPLATE_CONTEXT_BUILDER settings key
*   Fix invalid config in README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants