Ejemplo n.º 1
0
 def save(self, *args, **kwargs):
     super(Config, self).save(*args, **kwargs)
     self.site_name = self.site.name
     key = create_cache_key(Config,
                            field="site__id",
                            field_value=self.site.id)
     cache.set(key, self)
Ejemplo n.º 2
0
 def get_current():
     site = Site.objects.get_current()
     key = create_cache_key(Config, field="site__id", field_value=site.id)
     config = cache.get(key, None)
     if config is None:
         try:
             config = Config.objects.get(site=site)
             cache.add(key, config)
         except Config.DoesNotExist:
             return None
     return config
Ejemplo n.º 3
0
 def get_current():
     site = Site.objects.get_current()
     key = create_cache_key(Config, field="site__id", 
                            field_value=site.id)
     config = cache.get(key, None)
     if config is None:
         try:
             config = Config.objects.get(site=site)
             cache.add(key, config)
         except Config.DoesNotExist:
             return None
     return config
Ejemplo n.º 4
0
 def save(self, *args, **kwargs):
     super(Config, self).save(*args, **kwargs)
     self.site_name = self.site.name
     key = create_cache_key(Config, field="site__id", 
                            field_value=self.site.id)
     cache.set(key, self)