def slugurl(context, slug): """Returns the URL for the page that has the given slug.""" page = Page.objects.filter(slug=slug).first() if page: return pageurl(context, page) else: return None