~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to wlprofile/models.py

  • Committer: Holger Rapp
  • Date: 2012-03-17 16:22:06 UTC
  • Revision ID: sirver@gmx.de-20120317162206-fgttamk22qt1nytj
Let post count be calculated automatically instead of keeping track of it manually. Let's see how this affects performance

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
    def post_count(self):
54
54
        """
55
55
        Return the nr of posts the user has. This uses djangos filter feature
56
 
        will therefore hit the database. This should maybe be reworked when the 
 
56
        will therefore hit the database. This should maybe be reworked when the
57
57
        database grows to not be always calculated.
58
58
        """
59
59
        return Post.objects.filter(user=self.user).count()
60
 
  
 
60
 
61
61
    def user_status(self):
62
62
        nump = self.post_count()
63
 
       
 
63
 
64
64
        if nump < 6:
65
65
            return { "text":"Just found this site", "image":"rang_1.png" }
66
66
        elif nump < 50: