django-timezones icon indicating copy to clipboard operation
django-timezones copied to clipboard

Add localtime_for_user filter

Open paltman opened this issue 14 years ago • 1 comments

turn this:

{{ match.start|localtime:request.user.account_set.all.0.timezone|date:"n/d/y"}}

into this:

{{ match.start|localtime:request|date:"n/d/y"}}

In addition, pull the timezone out of session if it is there than hitting the database every single usage of the template filter.

I realize that this is a boundry crossing into Accounts so might be more appropriate elsewhere.

paltman avatar Feb 01 '11 17:02 paltman

Maby adding a TIMEZONES_USERTIME_CALLBACK setting that would be a dotted path to a callable that is passed a datetime and a user object. Then a usertime filter could easily call that and an account app could implement the specific ORM call.

jezdez avatar Feb 02 '11 13:02 jezdez