Piki is a minimal wiki
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

views.py 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. from django.shortcuts import render
  2. from django.http import HttpResponse, HttpResponseRedirect
  3. from django.utils.translation import gettext as _
  4. import logging
  5. import config
  6. from . import url_page
  7. from .context import context_adaption
  8. from .help import help_pages
  9. from .page import page
  10. from themes import Context
  11. logger = logging.getLogger(__name__)
  12. def root(request):
  13. return HttpResponseRedirect(url_page(request, config.STARTPAGE))
  14. def pages(request, rel_path=''):
  15. context = Context(request) # needs to be executed first because of time mesurement
  16. #
  17. p = page(rel_path)
  18. #
  19. context_adaption(
  20. context,
  21. request,
  22. title=p.title,
  23. upload_path=p.attachment_path,
  24. page_content=p.render_to_html(request)
  25. )
  26. return render(request, 'pages/page.html', context=context)
  27. def search(request):
  28. context = Context(request) # needs to be executed first because of time mesurement
  29. context_adaption(
  30. context,
  31. request,
  32. page_content="Search is not yet implemented..."
  33. )
  34. return render(request, 'pages/page.html', context=context)
  35. def helpview(request, page='main'):
  36. context = Context(request) # needs to be executed first because of time mesurement
  37. page_content = help_pages[page]
  38. context_adaption(
  39. context, # the base context
  40. request, # the request object to be used in context_adaption
  41. current_help_page=page, # the current help_page to identify which taskbar entry has to be highlighted
  42. page_content=page_content, # the help content itself (template)
  43. title=_('Help') # the title for the page (template)
  44. )
  45. return render(request, 'pages/page.html', context=context)