Esempio n. 1
0
def page_edit(request, slug):
    page = get_or_none(Page, slug=slug)
    if not page:
        title = slug.replace('-', ' ')
    else:
        title = page.name
    if request.method == "POST":
        new_content = request.POST.get('edit')
        if page:
            page.content = new_content
            page.save()
        else:
            page = Page(name=title, content=new_content, slug=slug)
            page.save()
    return direct_to_template(request, 'wiki/page_edit.html', locals())
Esempio n. 2
0
def page_view(request, slug):
    page = get_or_none(Page, slug=slug)
    if not page:
        # Don't tell me this isn't good. I know it isn't good.
        deslug = slug.replace('-', ' ')
    return direct_to_template(request, 'wiki/page_view.html', locals())