[FIX] website: menus with null URL would throw an error on display
Before this commit, if a website.menu had a URL set to null, it would throw an error when displaying that menu. It is normally not possible to do so in v11 but after a migration, menus can be empty. (eg: Using an empty menu to display a divider in a dropdown menu) Now we return an empty url instead of an error
This commit is contained in:
@@ -815,7 +815,7 @@ class Menu(models.Model):
|
||||
url = self.page_id.sudo().url
|
||||
else:
|
||||
url = self.url
|
||||
if not self.url.startswith('/'):
|
||||
if url and not self.url.startswith('/'):
|
||||
if '@' in self.url:
|
||||
if not self.url.startswith('mailto'):
|
||||
url = 'mailto:%s' % self.url
|
||||
|
||||
Reference in New Issue
Block a user