challenge_short_name = settings.MAIN_PROJECT_NAME
try:
site = getSite(challenge_short_name)
except Challenge.DoesNotExist:
link = reverse("challenges:create")
link = link + "?short_name=%s" % challenge_short_name
link_html = create_HTML_a(
link, "Create project "%s"" % challenge_short_name
)
html = I"m trying to show the first page for main project "%s" here,
but "%s" does not exist. %s. % (
challenge_short_name,
challenge_short_name,
link_html,
)
page = create_temp_page(title="no_pages_found", html=html)
return render(
request,
"temppage.html",
{"site": page.challenge, "currentpage": page},
)
pages = site.page_set.all()
if len(pages) == 0:
link = reverse("pages:list", args=[challenge_short_name])
link_html = create_HTML_a(link, "admin interface")
html = I"m trying to show the first page for main project "%s" here,
but "%s" contains no pages. Please add
some in the %s. % (
challenge_short_name,
challenge_short_name,
link_html,
)
page = create_temp_page(title="no_pages_found", html=html)
return render(
request,
"temppage.html",
{"site": page.challenge, "currentpage": page},
)
if page_title:
pages = [p for p in pages if p.title.lower() == page_title.lower()]
if len(pages) != 1:
raise ValueError(
f"More than 1 page with title {page_title} was found for {site}"
)
page = pages[0]
page.html = renderTags(request, page)
return render(request, "page.html", {"currentpage": page})