Opened 6 years ago

Closed 3 years ago

#16096 closed New feature (fixed)

Template instances should have an origin attribute.

Reported by: Jeremy Dunck Owned by: nobody
Component: Template system Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Templates are constructed with an optional origin argument; this is used for debugging purposes.

But I think it would be useful for the Template instance to have an origin attribute -- then template origins could be more easily inspected and logged outside the django.template infrastructure. The specific use case I have in mind is making it clearer to FE devs which templates/template dirs are being used for a given request.

Template's constructor receives an origin parameter, so this should be a simple change.

Change History (5)

comment:1 Changed 6 years ago by Julien Phalip

Triage Stage: UnreviewedAccepted

This makes sense and it can't hurt. Are you thinking of any particular API other than just setting the origin attribute to the Template instance?

comment:2 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:3 Changed 3 years ago by Preston Timmons

I added a pull request for this here.

https://github.com/django/django/pull/1534

comment:4 Changed 3 years ago by Tim Graham

Has patch: set
Patch needs improvement: set

comment:5 Changed 3 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In 8625c7aab3760d16572792fea23a95e572e28ead:

Fixed #16096 -- Added origin attribute to template instances.

Thanks jdunck for the suggestion.

Note: See TracTickets for help on using tickets.
Back to Top