Opened 10 years ago

Closed 7 years ago

#3895 closed (fixed)

archive_index should have template_object_name

Reported by: marchino <marco.giusti@…> Owned by: nobody
Component: Generic views Version: master
Severity: Keywords:
Cc: marco.giusti@…, toke-django@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

Description

generic views archive_index and object_list are logically the same thing: a list of objects so they can use the same template but archive_index uses latest as template_object_name and object_list appends '_list' to it, so it is impossible to do this.

with this small patch is possible to use the same object name with both generic views. maybe you sould look deeper for a more consistency in generic views, i didn't.

Attachments (2)

patch.django.date_based (924 bytes) - added by marchino <marco.giusti@…> 10 years ago.
patch.django_date_based (2.1 KB) - added by Thomas Kerpe 9 years ago.
Improved Patch against [6147] - added Documentation.

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by marchino <marco.giusti@…>

Attachment: patch.django.date_based added

Changed 9 years ago by Thomas Kerpe

Attachment: patch.django_date_based added

Improved Patch against [6147] - added Documentation.

comment:1 Changed 9 years ago by Thomas Kerpe

Cc: toke-django@… added
Triage Stage: UnreviewedDesign decision needed

archive_index and object_list are not completly interchangable of course.
Also there is the issue with appending _list to template_object_name.
archive_index is somewhat inconsistent with that.

methodhas template_object_name?appends _list?
archive_indexno 1)no
archive_yearyesyes
archive_monthyesyes
archive_weekyesyes
archive_dayyesyes
object_listyesyes

1) Patch will fix this

How to address the appending of _list without breaking something?
Adding it only if template_object_name was set is not consistent.

comment:2 Changed 9 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [6157]) Fixed #3895 -- Added ability to customize the context variable in the archive_index generic view. Thanks to marco.giusti@… and toke-django@….

comment:3 Changed 7 years ago by chrisrobison

Patch needs improvement: set

Using template_object_name in archive_index is said to be fixed, however, I don't believe it is working how it should. I have created a date_based blog and once I assign a template_object_name of 'entry', I then have to change the template to something that seems backwards.

instead of:

{% for entry in latest %}

{% entry.title %}

it must be:

{% for latest in entry %}

{% latest.title %}

This is not consistent with the other date_based templates.

comment:4 in reply to:  3 Changed 7 years ago by chrisrobison

Resolution: fixed
Status: closedreopened

comment:5 Changed 7 years ago by Alex Gaynor

Resolution: fixed
Status: reopenedclosed

This bug was fixed 2 years ago, if you think there is a new bug please file a new ticket.

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