def save(self, *args, **kwargs): # If template is a translation, use default template's name if self.default_template and not self.name: self.name = self.default_template.name template = super(EmailTemplate, self).save(*args, **kwargs) cache.delete(self.name) return template
def test_basic_cache_operations(self): """ Test basic cache operations """ # clean test cache cache.cache_backend.clear() self.assertEqual(None, cache.get("test-cache")) cache.set("test-cache", "awesome content") self.assertTrue("awesome content", cache.get("test-cache")) cache.delete("test-cache") self.assertEqual(None, cache.get("test-cache"))
def test_basic_cache_operations(self): """ Test basic cache operations """ # clean test cache cache.cache_backend.clear() self.assertEqual(None, cache.get('test-cache')) cache.set('test-cache', 'awesome content') self.assertTrue('awesome content', cache.get('test-cache')) cache.delete('test-cache') self.assertEqual(None, cache.get('test-cache'))
def save(self, *args, **kwargs): # If template is a translation, use default template's name if self.default_template and not self.name: self.name = self.default_template.name site = sites_models.Site.objects.get_current() if site.pk: self.site = site template = super(EmailTemplate, self).save(*args, **kwargs) cache.delete(self.name) return template
def save(self, *args, **kwargs): # If template is a translation, use default template's name if self.default_template: if not self.name: self.name = self.default_template.name if not self.template_path: self.template_path = self.default_template.template_path if not self.template_path: self.template_path = self.TEMPLATE_CHOICES[0][0] self.update_mail_content() obj = super(EmailTemplate, self).save(*args, **kwargs) cache.delete(self.name) return obj
def save(self, *args, **kwargs): template = super(EmailTemplate, self).save(*args, **kwargs) cache.delete(self.name) return template
def save(self, *args, **kwargs): self.last_updated = now template = super(EmailTemplate, self).save(*args, **kwargs) cache.delete(self.name) return template