Opened 4 years ago

Closed 4 years ago

#16175 closed New feature (fixed)

Use TemplateResponse in django.contrib.sitemaps

Reported by: mat Owned by: nobody
Component: contrib.sitemaps Version: master
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 mat 4 years ago.
Patch (with docs) against [16341]

Download all attachments as: .zip

Change History (7)

comment:1 Changed 4 years ago by aaugustin

  • Needs documentation set
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 4 years ago by mat

Patch (with docs) against [16341]

comment:2 Changed 4 years ago by aaugustin

  • Needs documentation unset

comment:3 Changed 4 years ago by klette

  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 4 years ago by jezdez

  • Needs tests set
  • Triage Stage changed from Ready for checkin to Accepted

comment:5 Changed 4 years ago by mat

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

comment:6 Changed 4 years ago by jezdez

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

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