Skip to content

Fix email template rendering for product_type_added notification#14220

Merged
rossops merged 2 commits intoDefectDojo:devfrom
omartinex:fix/product-type-added-email-template
Feb 9, 2026
Merged

Fix email template rendering for product_type_added notification#14220
rossops merged 2 commits intoDefectDojo:devfrom
omartinex:fix/product-type-added-email-template

Conversation

@omartinex
Copy link

Description

This PR fixes a Django template rendering error in the product_type_added email notification.

The original template used an invalid blocktranslate syntax by:

  • Omitting the required with keyword, and
  • Passing a filtered variable (url|full_url) directly into the blocktranslate tag.

This caused email notifications to fail at render time with the following error:

Unknown argument for 'blocktranslate' tag: 'prod_url=url|full_url'

The issue does not affect DefectDojo service startup or application availability.
It only impacts email delivery when a product_type_added notification is triggered.

The fix ensures Django-compliant usage of blocktranslate by resolving the URL outside the tag and passing only valid variables.

Test results

  • Manually tested by triggering a product_type_added notification.
  • Confirmed that the email template renders correctly and the notification is sent without errors.
  • Verified that no errors are logged during template rendering after the fix.

No automated tests were added, as this change affects a Django email template and is covered via manual validation.

Documentation

No documentation changes are required.
This PR fixes a template-level bug without introducing new functionality or configuration changes.

Checklist

  • Rebased against the latest bugfix branch.
  • Bugfix submitted against the bugfix branch.
  • PR title is meaningful and suitable for release notes.
  • No Python code changes (template-only fix).
  • No model changes or migrations required.
  • Manual testing performed and verified.

Extra information

This fix restores proper email notification behavior for product type creation events and aligns the template with Django i18n best practices.

Comment on lines -27 to -37
<p>
{% url 'notifications' as notification_url %}
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">{% trans "Disclaimer" %}</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer_notifications }}</p>
</div>
{% endif %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why you're leaving out this part?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for flagging this. There was no specific reason to remove that section, the intent of this PR is only to fix the template rendering issue.
I’ll restore that part to avoid introducing unrelated changes.

@valentijnscholten
Copy link
Member

Thanks for the PR, please see my comment.

Copy link
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@valentijnscholten valentijnscholten modified the milestones: 2.55.3, 2.55.2 Feb 8, 2026
@rossops rossops merged commit 9874f5a into DefectDojo:dev Feb 9, 2026
90 checks passed
fopina pushed a commit to fopina/django-DefectDojo that referenced this pull request Feb 16, 2026
…dded-email-template

Fix email template rendering for product_type_added notification
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants