]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/models/meta.py
Some changes necessary to make cache work on Django 1.2.
[osqa.git] / forum / models / meta.py
index 3fd068081e3ef1d7cc65b2744d22dc9f38a52b88..fca763fd5d78a0db59a22900c6d0cc2d0490092a 100644 (file)
@@ -24,21 +24,26 @@ class Flag(models.Model):
         app_label = 'forum'\r
         unique_together = ('user', 'node')\r
 \r
-class BadgeManager(models.Manager):\r
-    use_for_related_fields = True\r
-    \r
+class BadgesQuerySet(models.query.QuerySet):\r
     def get(self, *args, **kwargs):\r
         try:\r
             pk = [v for (k,v) in kwargs.items() if k in ('pk', 'pk__exact', 'id', 'id__exact')][0]\r
         except:\r
-            return super(BadgeManager, self).get(*args, **kwargs)\r
+            return super(BadgesQuerySet, self).get(*args, **kwargs)\r
 \r
         from forum.badges.base import BadgesMeta\r
         badge = BadgesMeta.by_id.get(int(pk), None)\r
         if not badge:\r
-            return super(BadgeManager, self).get(*args, **kwargs)\r
+            return super(BadgesQuerySet, self).get(*args, **kwargs)\r
         return badge.ondb\r
 \r
+\r
+class BadgeManager(models.Manager):\r
+    use_for_related_fields = True\r
+\r
+    def get_query_set(self):\r
+        return BadgesQuerySet(self.model)\r
+\r
 class Badge(models.Model):\r
     GOLD = 1\r
     SILVER = 2\r