Opened 7 years ago

Closed 7 years ago

#3488 closed (fixed)

DateFormat should have a b() method

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


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

def archive_day(... month_format='%b' ...):
        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@…> 7 years ago.
patch and docs

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by Gary Wilson <gary.wilson@…>

patch and docs

comment:1 Changed 7 years ago by Gary Wilson <gary.wilson@…>

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 7 years ago by jacob

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

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

comment:3 Changed 7 years ago by jacob

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

comment:4 Changed 7 years ago by jacob

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

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

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.