Opened 7 years ago

Last modified 5 years ago

#19698 closed Bug

Deleting Sites through a manager does not clear cache — at Initial Version

Reported by: ddavies@… Owned by: nobody
Component: contrib.sites Version: 1.4
Severity: Normal Keywords:
Cc: Serdar Dalgic Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


When you delete a Site instance, i.e. Site.objects.get_current().delete(), the cache is cleared. However, if you delete all sites, Site.objects.all().delete(), the cache is not cleared.

def test_delete_all_sites_clears_cache(self):

When all site objects are deleted the cache should also
be cleared and get_current should raise a DoesNotExist
from django.contrib.sites.models import Site
site = Site.objects.create(domain='', name='test')
self.assertIsInstance(Site.objects.get_current(), Site)
self.assertRaises(Site.DoesNotExist, Site.objects.get_current)

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top