]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/models/question.py
convertd comments to nodes
[osqa.git] / forum / models / question.py
index 485576d5522af30a4d3935ba51f3016ff283802d..da8083f6d1407f41d46649fce8593ea59ee3d01d 100644 (file)
@@ -17,7 +17,7 @@ class Question(QandA):
     view_count           = models.IntegerField(default=0)
     favourite_count      = models.IntegerField(default=0)
     last_activity_at     = models.DateTimeField(default=datetime.datetime.now)
-    last_activity_by     = models.ForeignKey(User, related_name='last_active_in_questions')
+    last_activity_by     = models.ForeignKey(User, related_name='last_active_in_questions', null=True)
 
     favorited_by         = models.ManyToManyField(User, through='FavoriteQuestion', related_name='favorite_questions')
 
@@ -38,12 +38,10 @@ class Question(QandA):
     def answer_accepted(self):
         return self.accepted_answer is not None
 
-    def delete(self):
-        super(Question, self).delete()
-        try:
-            ping_google()
-        except Exception:
-            logging.debug('problem pinging google did you register you sitemap with google?')
+    def save(self, *args, **kwargs):
+        if not self.last_activity_by:
+            self.last_activity_by = self.author
+        super(Question, self).save(*args, **kwargs)
 
     def update_last_activity(self, user):
         self.last_activity_by = user
@@ -78,9 +76,6 @@ class Question(QandA):
     def get_revision_url(self):
         return reverse('question_revisions', args=[self.id])
 
-    def get_latest_revision(self):
-        return self.revisions.all()[0]
-
     def get_related_questions(self, count=10):
         cache_key = '%s.related_questions:%d:%d' % (settings.APP_URL, count, self.id)
         related_list = cache.get(cache_key)