Code

Opened 3 years ago

Closed 7 months ago

#16096 closed New feature (fixed)

Template instances should have an origin attribute.

Reported by: jdunck 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.

Attachments (0)

Change History (5)

comment:1 Changed 3 years ago by julien

  • Triage Stage changed from Unreviewed to Accepted

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 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:3 Changed 8 months ago by prestontimmons

I added a pull request for this here.

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

comment:4 Changed 8 months ago by timo

  • Has patch set
  • Patch needs improvement set

comment:5 Changed 7 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 8625c7aab3760d16572792fea23a95e572e28ead:

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

Thanks jdunck for the suggestion.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.