Opened 8 years ago

Closed 6 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@…> 8 years ago.
patch.django_date_based (2.1 KB) - added by toke 8 years ago.
Improved Patch against [6147] - added Documentation.

Download all attachments as: .zip

Change History (7)

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

Changed 8 years ago by toke

Improved Patch against [6147] - added Documentation.

comment:1 Changed 8 years ago by toke

  • Cc toke-django@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design 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 8 years ago by russellm

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

(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 follow-up: Changed 6 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 6 years ago by chrisrobison

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:5 Changed 6 years ago by Alex

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

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