Django

Code

Ticket #3488 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

DateFormat should have a b() method

Reported by: Gary Wilson <gary.wilson@gmail.com> Assigned to: adrian
Milestone: Component: Tools
Version: SVN Keywords:
Cc: Triage Stage: Design decision needed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

3488.diff (1.4 kB) - added by Gary Wilson <gary.wilson@gmail.com> on 02/13/07 10:46:13.
patch and docs

Change History

02/13/07 10:46:13 changed by Gary Wilson <gary.wilson@gmail.com>

  • attachment 3488.diff added.

patch and docs

02/13/07 10:50:11 changed by Gary Wilson <gary.wilson@gmail.com>

  • needs_better_patch changed.
  • has_patch set to 1.
  • stage changed from Unreviewed to Design decision needed.
  • needs_tests changed.
  • needs_docs changed.

02/25/07 10:29:10 changed by jacob

  • status changed from new to closed.
  • resolution set to fixed.

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

02/25/07 23:19:08 changed by jacob

  • status changed from closed to reopened.
  • resolution deleted.

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

02/28/07 10:18:55 changed by jacob

  • status changed from reopened to closed.
  • resolution set to fixed.

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


Add/Change #3488 (DateFormat should have a b() method)




Change Properties
Action