diff options
author | eliott <eliott@cactuswax.net> | 2007-12-29 15:34:02 -0800 |
---|---|---|
committer | eliott <eliott@cactuswax.net> | 2007-12-29 15:34:02 -0800 |
commit | 15ceff77fef19819cba43e866938311aeffd0732 (patch) | |
tree | 16903554adbb32300aad9a5b3d647679710e9302 /wiki/views.py | |
parent | d1cc0f54a490e5eacf07107e461672979266f461 (diff) |
Modified render_template and renamed it to render_response (consistent with
archweb_pub conventions).
Moved pkgmaint_guide to a template.
Diffstat (limited to 'wiki/views.py')
-rw-r--r-- | wiki/views.py | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/wiki/views.py b/wiki/views.py index 4e4444a4..9f7bd78d 100644 --- a/wiki/views.py +++ b/wiki/views.py @@ -3,59 +3,59 @@ # from django.http import HttpResponse, HttpResponseRedirect from django.contrib.auth.decorators import login_required -from archweb_dev.utils import render_template +from archweb_dev.lib.utils import render_response from archweb_dev.wiki.models import Wikipage @login_required def index(request): - """Return a list of all wiki pages""" - pages = Wikipage.objects.all().order_by('title') - return render_template('wiki/home.html', request, {'pages':pages}) + """Return a list of all wiki pages""" + pages = Wikipage.objects.all().order_by('title') + return render_response(request, 'wiki/home.html', {'pages':pages}) def main(request): - """Return the Index wiki page""" - return HttpResponseRedirect("/wiki/WikiIndex/") + """Return the Index wiki page""" + return HttpResponseRedirect("/wiki/WikiIndex/") @login_required def page(request, title): - """Display page, or redirect to root if page doesn't exist yet""" - try: - page = Wikipage.objects.get(title__exact=title) - return render_template('wiki/page.html', request, {'page':page}) - except Wikipage.DoesNotExist: - return HttpResponseRedirect("/wiki/edit/%s/" % title) + """Display page, or redirect to root if page doesn't exist yet""" + try: + page = Wikipage.objects.get(title__exact=title) + return render_response(request, 'wiki/page.html', {'page':page}) + except Wikipage.DoesNotExist: + return HttpResponseRedirect("/wiki/edit/%s/" % title) @login_required def edit(request, title): - """Process submitted page edits (POST) or display editing form (GET)""" - if request.POST: - try: - page = Wikipage.objects.get(title__exact=title) - except Wikipage.DoesNotExist: - # Must be a new one; let's create it - page = Wikipage(title=title) - page.content = request.POST['content'] - page.title = request.POST['title'] - page.last_author = request.user - page.save() - return HttpResponseRedirect("/wiki/" + page.title + "/") - else: - try: - page = Wikipage.objects.get(title__exact=title) - except Wikipage.DoesNotExist: - # create a dummy page object -- note that it is not saved! - page = Wikipage(title=title) - page.body = "<!-- Enter content here -->" - return render_template('wiki/edit.html', request, {'page':page}) + """Process submitted page edits (POST) or display editing form (GET)""" + if request.POST: + try: + page = Wikipage.objects.get(title__exact=title) + except Wikipage.DoesNotExist: + # Must be a new one; let's create it + page = Wikipage(title=title) + page.content = request.POST['content'] + page.title = request.POST['title'] + page.last_author = request.user + page.save() + return HttpResponseRedirect("/wiki/" + page.title + "/") + else: + try: + page = Wikipage.objects.get(title__exact=title) + except Wikipage.DoesNotExist: + # create a dummy page object -- note that it is not saved! + page = Wikipage(title=title) + page.body = "<!-- Enter content here -->" + return render_response(request, 'wiki/edit.html', {'page':page}) @login_required def delete(request): - """Delete a page""" - if request.POST: - title = request.POST['title'] - try: - page = Wikipage.objects.get(title__exact=title) - except Wikipage.DoesNotExist: - return HttpResponseRedirect("/wiki/") - page.delete() - return HttpResponseRedirect("/wiki/") + """Delete a page""" + if request.POST: + title = request.POST['title'] + try: + page = Wikipage.objects.get(title__exact=title) + except Wikipage.DoesNotExist: + return HttpResponseRedirect("/wiki/") + page.delete() + return HttpResponseRedirect("/wiki/") |