Opened 13 years ago

Closed 13 years ago

#16175 closed New feature (fixed)

Use TemplateResponse in django.contrib.sitemaps

Reported by: Mathieu Pillard Owned by: nobody
Component: contrib.sitemaps Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Like it was done for the admin in #15008 , it would be useful to convert django.contrib.sitemaps views to TemplateResponse, in order to help apps/projects re-use it while adding some stuff in the context.

For instance, the django-news-sitemaps news_sitemap() view is almost a straight copy/paste from django.contrib.sitemaps.views.sitemap(), just adding a couple items in the context (and changing a couple other lines but that's a different issue)

Attached is a very simple patch that does exactly that, passing all current tests.

Attachments (1)

sitemaps-use-templateresponse.diff (2.2 KB ) - added by Mathieu Pillard 13 years ago.
Patch (with docs) against [16341]

Download all attachments as: .zip

Change History (7)

comment:1 by Aymeric Augustin, 13 years ago

Needs documentation: set
Triage Stage: UnreviewedAccepted

by Mathieu Pillard, 13 years ago

Patch (with docs) against [16341]

comment:2 by Aymeric Augustin, 13 years ago

Needs documentation: unset

comment:3 by Kristian Klette, 13 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by Jannis Leidel, 13 years ago

Needs tests: set
Triage Stage: Ready for checkinAccepted

comment:5 by Mathieu Pillard, 13 years ago

What kind of tests would be appropriate ? Just something to check if the response is a TemplateResponse? Something else ?

comment:6 by Jannis Leidel, 13 years ago

Resolution: fixed
Status: newclosed

In [16476]:

Fixed #16175 -- Modified the sitemaps views to return TemplateResponse instances for easier customization. Thanks, mat.

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