6๐
A Page
model has a field url_path
. You thus can access the page URL with:
class PageUrl(Page):
def returnPageUrl(self):
return self.url_path
or you can make use of full_url
to obtain the full url (including the hostname, etc.):
class PageUrl(Page):
def returnPageUrl(self):
return self.full_url
That being said, since it is already a field, I think there is not much use to define an extra method for this.
Source:stackexchange.com