torchbox / django-pattern-library

UI pattern libraries for Django templates
https://torchbox.github.io/django-pattern-library/
BSD 3-Clause "New" or "Revised" License
360 stars 44 forks source link

Template tags can't be overwritten under Django v4.1 #203

Closed vorlif closed 1 year ago

vorlif commented 1 year ago

Found a bug? Please fill out the sections below. 👍

Issue Summary

Template tags cannot be overwritten under Django v4.1 because a check has been introduced to prevent this.

ERRORS:
?: (templates.E003) 'wagtailcore_tags' is used for multiple template tag modules: 'project.project_styleguide.templatetags.wagtailcore_tags', 'wagtail.templatetags.wagtailcore_tags'
?: (templates.E003) 'wagtailimages_tags' is used for multiple template tag modules: 'project.project_styleguide.templatetags.wagtailimages_tags', 'wagtail.images.templatetags.wagtailimages_tags'

Workaround:

Disable the check in the settings:

+ SILENCED_SYSTEM_CHECKS = ["templates.E003"]

Steps to Reproduce

  1. Follow the documentation to overwrite a tag
  2. Start the server python manage.py runserver

Please tell me if more detailed instructions are needed.

Technical details

thibaudcolas commented 1 year ago

Thank you for the report @vorlif! I’m surprised we’ve not run into this yet, it could be because we don’t make use of system checks, or we’re still slow to upgrade to Django v4.1.

kbayliss commented 1 year ago

Django 4.1.2 changes this behaviour to raise warnings instead of errors: https://github.com/django/django/commit/f71b0cf769d9ac5