Skip to content

Instantly share code, notes, and snippets.

@dustinmm80
Created February 24, 2012 04:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dustinmm80/1897594 to your computer and use it in GitHub Desktop.
Save dustinmm80/1897594 to your computer and use it in GitHub Desktop.
template tags
class ProfileTimezoneMiddleware(GlobalTimezoneMiddleware):
def get_tz(self, request):
if hasattr(request, 'user') and request.user.is_authenticated() and request.user.has_profile():
profile = request.user.get_profile()
return profile.timezone
return get_tz_from_request(request)
<div class="dealroom-message-timestamp alignright">{{ message.timestamp|to_global_tz|date:'H:i:s' }}</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment