Ticket #9228: sites2.diff
File sites2.diff, 1.3 KB (added by , 16 years ago) |
---|
-
django/contrib/sites/tests.py
3 3 >>> from django.conf import settings 4 4 >>> Site(id=settings.SITE_ID, domain="example.com", name="example.com").save() 5 5 6 >>> # Make sure that save() remove the relevant key from the SITE_CACHE dictionary. 7 >>> s = Site.objects.get_current() 8 >>> isinstance(s, Site) 9 True 10 11 >>> s.domain = "example2.com" 12 >>> s.name = "example2.com" 13 >>> s.save() 14 >>> s = Site.objects.get_current() 15 >>> s.domain 16 'example2.com' 17 18 >>> s.name 19 'example2.com' 20 6 21 >>> # Make sure that get_current() does not return a deleted Site object. 7 22 >>> s = Site.objects.get_current() 8 23 >>> isinstance(s, Site) -
django/contrib/sites/models.py
42 42 def __unicode__(self): 43 43 return self.domain 44 44 45 def save(self, force_insert=False, force_update=False): 46 super(Site, self).save(force_insert, force_update) 47 del SITE_CACHE[self.pk] 48 45 49 def delete(self): 46 50 pk = self.pk 47 51 super(Site, self).delete()