Opened 18 years ago

Closed 18 years ago

#3488 closed (fixed)

DateFormat should have a b() method

Reported by: Gary Wilson <gary.wilson@…> Owned by: Adrian Holovaty
Component: Tools Version: dev
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The date-based generic views use %b as the default month formatter:

def archive_day(... month_format='%b' ...):
[snip]
        date = datetime.date(*time.strptime(year+month+day, '%Y'+month_format+day_format)[:3])

and in my template I would like to link to the previous/next day with something like:

<a href="/log/{{ previous_day|date:"Y/b/d/" }}">Previous day</a>

but can't since django.utils.dateformat.DateFormat has no b() method.

Note that you could work around this using the lower template filter:

<a href="/log/{{ previous_day|date:"Y/M/d/"|lower }}">Previous day</a>

but having to work around this seems silly since %b is the default used in the generic views.

Attachments (1)

3488.diff (1.4 KB ) - added by Gary Wilson <gary.wilson@…> 18 years ago.
patch and docs

Download all attachments as: .zip

Change History (5)

by Gary Wilson <gary.wilson@…>, 18 years ago

Attachment: 3488.diff added

patch and docs

comment:1 by Gary Wilson <gary.wilson@…>, 18 years ago

Has patch: set
Triage Stage: UnreviewedDesign decision needed

comment:2 by Jacob, 18 years ago

Resolution: fixed
Status: newclosed

(In [4574]) Fixed #3488: send_mail no longer uses settings in function default arguments. Thanks to Per Jonsson for the patch.

comment:3 by Jacob, 18 years ago

Resolution: fixed
Status: closedreopened

D'oh, I meant #3448. My dyslexia is really acting up these days.

comment:4 by Jacob, 18 years ago

Resolution: fixed
Status: reopenedclosed

(In [4647]) Fixed #3488: Added "b" option to date format filter. Thanks, Gary Wilson.

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