Andrei Kavaleu avatar Andrei Kavaleu committed 14ec811

#74 forum_time tag and Reputation.__unicode__ print local time

Comments (0)

Files changed (2)

djangobb_forum/models.py

         unique_together = (('from_user', 'post'),)
 
     def __unicode__(self):
-        return u'T[%d], FU[%d], TU[%d]: %s' % (self.post.id, self.from_user.id, self.to_user.id, unicode(self.time))
+        time = timezone.localtime(self.time)
+        return u'T[%d], FU[%d], TU[%d]: %s' % (self.post.id, self.from_user.id, self.to_user.id, unicode(time))
 
 
 class ProfileManager(models.Manager):

djangobb_forum/templatetags/forum_extras.py

 from django.db import settings
 from django.utils.html import escape
 from django.utils.hashcompat import md5_constructor
+from django.utils import timezone
 from django.contrib.humanize.templatetags.humanize import naturalday
 
 from pagination.templatetags.pagination_tags import paginate
         self.time = template.Variable(time)
 
     def render(self, context):
-        time = self.time.resolve(context)
-        formated_time = u'%s %s' % (naturalday(time), time.strftime('%H:%M:%S'))
-        formated_time = mark_safe(formated_time)
-        return formated_time
+        time = timezone.localtime(self.time.resolve(context))
+        formatted_time = u'%s %s' % (naturalday(time), time.strftime('%H:%M:%S'))
+        formatted_time = mark_safe(formatted_time)
+        return formatted_time
 
 
 # TODO: this old code requires refactoring
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.