[Oi-commits] r1353 - trunk/forum

oi-commits at pardus.org.tr oi-commits at pardus.org.tr
Wed May 7 13:58:04 EEST 2008


Author: jnmbk
Date: Wed May  7 13:58:03 2008
New Revision: 1353

Modified:
   trunk/forum/views.py
Log:
faster

Modified: trunk/forum/views.py
=================================================================
--- trunk/forum/views.py	(original)
+++ trunk/forum/views.py	Wed May  7 13:58:03 2008
@@ -21,6 +21,7 @@
 from oi.forum import customgeneric
 
 from django.core.urlresolvers import reverse
+from django.core.exceptions import ObjectDoesNotExist
 from oi.st.models import Tag, News
 
 # import our function for sending e-mails and setting
@@ -139,8 +140,10 @@
         request.session.modified = True
 
         # is the user watching this topic?
-        if len(request.user.watchlist_set.filter(topic=topic_id)) > 0:
-            watching = True
+        try:
+            watching =  request.user.watchlist_set.get(topic=topic_id)
+        except ObjectDoesNotExist:
+            pass
 
     topic.views += 1
     topic.save()


More information about the Oi-commits mailing list