Changeset 402:801a271ca7dc for djangobb_forum/models.py
- Timestamp:
- Mar 4, 2012 3:35:02 PM (16 months ago)
- Branch:
- default
- File:
-
- 1 edited
-
djangobb_forum/models.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
djangobb_forum/models.py
r401 r402 316 316 317 317 class ProfileManager(models.Manager): 318 use_for_related_fields = True 318 319 def get_query_set(self): 319 320 qs = super(ProfileManager, self).get_query_set() 320 321 if forum_settings.REPUTATION_SUPPORT: 321 qs = qs.extra(select={'reply_total':'Select sum(sign) from djangobb_forum_reputation where to_user_id = djangobb_forum_profile.user_id group by to_user_id'}) 322 qs = qs.extra(select={ 323 'reply_total':'Select sum(sign) from djangobb_forum_reputation where to_user_id = djangobb_forum_profile.user_id group by to_user_id', 324 'reply_count_minus':"Select sum(sign) from djangobb_forum_reputation where to_user_id = djangobb_forum_profile.user_id and sign = '-1' group by to_user_id", 325 'reply_count_plus':"Select sum(sign) from djangobb_forum_reputation where to_user_id = djangobb_forum_profile.user_id and sign = '1' group by to_user_id", 326 }) 322 327 return qs 323 328 … … 364 369 return None 365 370 366 def reply_count_minus(self):367 return Reputation.objects.filter(to_user__id=self.user_id, sign=-1).count()368 369 def reply_count_plus(self):370 return Reputation.objects.filter(to_user__id=self.user_id, sign=1).count()371 372 373 371 class PostTracking(models.Model): 374 372 """
Note: See TracChangeset
for help on using the changeset viewer.
