]> git.openstreetmap.org Git - osqa.git/commitdiff
Fixes a bug where the profile page of users with now actions could explode.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 31 Aug 2010 22:26:14 +0000 (22:26 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 31 Aug 2010 22:26:14 +0000 (22:26 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@580 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/models/user.py
forum/skins/default/templates/users/info.html

index 5aa8cc8ef1f95a66413ae9c4457c95495c1f40d5..b18047e9295ccb208b18293cad1c188ef12e7bc6 100644 (file)
@@ -156,7 +156,10 @@ class User(BaseModel, DjangoUser):
 
     @property
     def last_activity(self):
-        return self.actions.order_by('-action_date')[0].action_date
+        try:
+            return self.actions.order_by('-action_date')[0].action_date
+        except:
+            return None
 
     @property
     def gravatar(self):
index efc49fdebd6295488db45a8f920c1f0bd46e54be..382378ffd694aa02f5521e9e86299b346bde8ece 100644 (file)
@@ -51,7 +51,7 @@
                 {% if view_user.last_seen %}
                 <tr>
                     <td>{% trans "last seen" %}</td>
-                    <td><strong title="{{ view_user.last_activity }}">{% diff_date view_user.last_activity %}</strong></td>
+                    <td><strong title="{{ view_user.last_activity }}">{% if view_user.last_activity %}{% diff_date view_user.last_activity %}{% else %}{% trans "Never" %}{% endif %}</strong></td>
                 </tr>
                 {% endif %}
                 {% if view_user.website %}