Exemple #1
0
def log(request, title=None):
    title = normalize_title(title)
    if title is None:
        all_edits = Edit.objects.all()
    else:
        all_edits = Edit.objects.filter(page__title=title)
    all_edits = all_edits.extra(order_by=['-date_created'])
    return render_to_response('wiki/log.html', {'all_edits': all_edits})
Exemple #2
0
def save(request, title):
    title = normalize_title(title)
    body = request.POST['body']
    page = Page.upsert(title, body)
    comment = request.POST['comment']
    edit = Edit(page=page, comment=comment)
    edit.save()
    return redirect("/wiki/%s" % title)
Exemple #3
0
def page(request, title):
    title = normalize_title(title)
    page = Page.exist(title)
    if page is None:
        context = {'title': title}
        context.update(csrf(request))
        return render_to_response('wiki/form.html', context)
    return render_to_response('wiki/page.html', {'page': page})
Exemple #4
0
def edit(request, title):
    title = normalize_title(title)
    page = Page.objects.get(title=title)
    context = {'title': title, 'body': page.body}
    context.update(csrf(request))
    return render_to_response('wiki/form.html', context)