def increase_monthly_counter(self, basedate=None): basedate = basedate or datetime.datetime.now() month = basedate.month key = MONTHLY_COUNTER_KEY(form_id=self.id, month=month) redis_store.incr(key) redis_store.expireat(key, unix_time_for_12_months_from_now(basedate))