示例#1
0
def get_root_page() -> Page:
    try:
        return Page.objects.get(depth=1)
    except Page.MultipleObjectsReturned:
        # Reraise MultipleObjectsReturned, but with our own message
        raise Site.MultipleObjectsReturned(
            'Foliage can\'t auto-determine the root page. '
            'More than one Page exists with depth 1 in the database!')
示例#2
0
def get_site() -> Site:
    try:
        return Site.objects.get()
    except Site.MultipleObjectsReturned:
        # Reraise MultipleObjectsReturned, but with our own message
        raise Site.MultipleObjectsReturned(
            'Foliage can\'t auto-determine the Wagtail Site. '
            'More than one Site exists in the database!')