Commits

Gustavo Picon  committed 1b491e8

caching the result of taggable_get_fields in Taggad.save

  • Participants
  • Parent commits 788ba10

Comments (0)

Files changed (1)

File taggable/models.py

         for fields, statsmodel in self.taggable_stats.items():
             qdict = dict(self.taggable_get_fields(fields))
             qset = statsmodel.objects.filter(**qdict)
-
             updated_rows = qset.update(count=models.F('count') + 1)
             if updated_rows == 0:
                 # 0 rows updated, this means we need to create a stats entry
-                qdict = dict(self.taggable_get_fields(fields))
                 qdict['count'] = 1
                 statsmodel(**qdict).save(force_insert=True)