Ticket #9228: sites_v3.diff

File sites_v3.diff, 1022 bytes (added by Gert Van Gool, 16 years ago)
  • django/contrib/sites/tests.py

     
    88>>> isinstance(s, Site)
    99True
    1010
     11>>> s.domain
     12u"example.com"
     13>>> s.domain = "example.org"
     14>>> s.save()
     15>>> s = Site.objects.get_current()
     16>>> s.domain
     17u"example.org"
    1118>>> s.delete()
    1219>>> Site.objects.get_current()
    1320Traceback (most recent call last):
  • django/contrib/sites/models.py

     
    4141
    4242    def __unicode__(self):
    4343        return self.domain
    44    
     44
     45    def save(self, **kwargs):
     46        super(Site, self).save(**kwargs)
     47        try:
     48            del(SITE_CACHE[self.pk])
     49        except KeyError:
     50            pass
     51
    4552    def delete(self):
    4653        pk = self.pk
    4754        super(Site, self).delete()
Back to Top