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:
@@ -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):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user