コード例 #1
0
ファイル: models.py プロジェクト: zhangy405/chalaoshi
 def save(self, *args, **kwargs):
     from tools import convert2PY
     if not self.pinyin or len(self.pinyin) == 0:
         self.pinyin = convert2PY(self.name)
     rate_distribution_key = 'rate_distribution'
     delCache(rate_distribution_key)
     super(Teacher, self).save(*args, **kwargs)
コード例 #2
0
ファイル: models.py プロジェクト: megrxu/chalaoshi
    def save(self, *args, **kwargs):
        from tools import convert2PY
        if not self.pinyin or len(self.pinyin) == 0:
            self.pinyin = convert2PY(self.name)
        # delete cache
        rate_distribution_key = 'rate_distribution'
        delCache(rate_distribution_key)

        teacher_rate_key = 'rate_%s' % self.id
        delCache(teacher_rate_key)

        super(Teacher, self).save(*args, **kwargs)
コード例 #3
0
ファイル: models.py プロジェクト: zhangy405/chalaoshi
    def getAll():
        key = 'college_list'
        #delCache(key)
        if getCache(key):
            return getCache(key)

        from tools import convert2PY
        colleges = list(College.objects.all().filter(display=True).order_by('name'))
        for college in colleges:
            college.pinyin = convert2PY(college.name[:1])
            college.name = college.name
        colleges = sorted(colleges, key=lambda college: college.pinyin)
        setCache(key,colleges)

        return colleges
コード例 #4
0
ファイル: models.py プロジェクト: megrxu/chalaoshi
    def getAll():
        key = 'college_list'
        #delCache(key)
        if getCache(key):
            return getCache(key)

        from tools import convert2PY
        colleges = list(
            College.objects.all().filter(display=True).order_by('name'))
        for college in colleges:
            college.pinyin = convert2PY(college.name[:1])
            college.name = college.name
        colleges = sorted(colleges, key=lambda college: college.pinyin)
        setCache(key, colleges)

        return colleges