brosner / django-timezones

A Django reusable app to deal with timezone localization for users.
MIT License
191 stars 64 forks source link

Add localtime_for_user filter #9

Open paltman opened 13 years ago

paltman commented 13 years ago

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.

jezdez commented 13 years ago

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.