1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #25692 -- Added natural keys support to Site model.

This commit is contained in:
j0hnsmith
2015-11-06 22:55:44 +00:00
committed by Tim Graham
parent 81006b9657
commit 0115f9faa5
3 changed files with 12 additions and 1 deletions

View File

@@ -78,6 +78,9 @@ class SiteManager(models.Manager):
global SITE_CACHE
SITE_CACHE = {}
def get_by_natural_key(self, domain):
return self.get(domain=domain)
@python_2_unicode_compatible
class Site(models.Model):
@@ -96,6 +99,9 @@ class Site(models.Model):
def __str__(self):
return self.domain
def natural_key(self):
return (self.domain,)
def clear_site_cache(sender, **kwargs):
"""