def do_default_site(self, using=DEFAULT_DB):
"""
If no site was selected, selects the site used to create the article
as the default site.
Returns True if an additional save is required, False otherwise.
"""
if not len(self.sites.all()):
sites = Site.objects.all()
if hasattr(sites, 'using'):
sites = sites.using(using)
self.sites.add(sites.get(pk=settings.SITE_ID))
return True
return False
评论列表
文章目录