AttributeError: 'Instance' object has no attribute 'page'
jedie opened this issue · 1 comments
jedie commented
The get_link() method access self.page if internal link is used:
def get_link(self):
if self.internal_link:
ref_page = self.internal_link
link = ref_page.get_absolute_url()
if ref_page.site_id != getattr(self.page, 'site_id', None):
ref_site = Site.objects._get_site_by_id(ref_page.site_id).domain
link = '//{}{}'.format(ref_site, link)
There is a warning in CMSPlugin():
@property
def page(self):
warnings.warn(
"Don't use the page attribute on CMSPlugins! CMSPlugins are not "
"guaranteed to have a page associated with them!",
DontUsePageAttributeWarning)
return self.placeholder.page if self.placeholder_id else None
In my case i get a AttributeError: 'Instance' object has no attribute 'page'