summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO1
-rw-r--r--devel/views.py13
-rw-r--r--main/utils.py4
-rw-r--r--packages/views.py7
-rw-r--r--todolists/views.py18
5 files changed, 19 insertions, 24 deletions
diff --git a/TODO b/TODO
index 93dd1b85..b9c49464 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,5 @@
TODO:
- refactor stats by templates in dashboard, maybe a templatetag
- - drop all references to render_response
- move some of the custom widgets and fields to their own module
- Look at every file and see if its still needed
- eg: calendar css and js
diff --git a/devel/views.py b/devel/views.py
index 2b78e533..64d1531f 100644
--- a/devel/views.py
+++ b/devel/views.py
@@ -1,7 +1,6 @@
from django import forms
from django.http import HttpResponseRedirect
from django.contrib.auth.models import User
-from archweb_dev.main.utils import render_response
from archweb_dev.main.models import Package, Todolist
from archweb_dev.main.models import Arch, Repo
from archweb_dev.main.models import UserProfile, News
@@ -13,14 +12,15 @@ def index(request):
maintainer=request.user).filter(
needupdate=True).order_by('repo', 'pkgname')
- return render_response(
- request, 'devel/index.html',
- {'pkgs': pkgs, 'todos': todos, 'maint': request.user,
+ return render_to_response(
+ 'devel/index.html',
+ RequestContext(request, {'pkgs': pkgs, 'todos': todos,
+ 'maint': request.user,
'repos': Repo.objects.all(), 'arches': Arch.objects.all(),
'maintainers':
[User(id=0, username="orphan", first_name="Orphans")] + list(
User.objects.all())
- })
+ }))
def change_notify(request):
maint = User.objects.get(username=request.user.username)
@@ -58,7 +58,8 @@ def change_profile(request):
return HttpResponseRedirect('/devel/')
else:
form = ProfileForm(initial={'email': request.user.email})
- return render_response(request, 'devel/profile.html', {'form': form})
+ return render_to_response('devel/profile.html',
+ RequestContext(request, {'form': form}))
def siteindex(request):
news = News.objects.order_by('-postdate', '-id')[:10]
diff --git a/main/utils.py b/main/utils.py
index f31689f8..74ec50ef 100644
--- a/main/utils.py
+++ b/main/utils.py
@@ -11,10 +11,6 @@ def prune_cache(django_page_url):
cache_postfix = '.d41d8cd98f00b204e9800998ecf8427e'
cache.delete('%s%s%s' % (cache_prefix,django_page_url,cache_postfix))
-def render_response(req, *args, **kwargs):
- kwargs['context_instance'] = RequestContext(req)
- return render_to_response(*args, **kwargs)
-
#utility to make a pair of django choices
make_choice = lambda l: [(str(m), str(m)) for m in l]
diff --git a/packages/views.py b/packages/views.py
index 69f97dbb..75bdc56f 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -9,7 +9,6 @@ from django.contrib.admin.widgets import AdminDateWidget
from django.views.generic import list_detail
from django.db.models import Q
import datetime
-from archweb_dev.main.utils import render_response
from archweb_dev.main.models import Package, PackageFile
from archweb_dev.main.models import Arch, Repo, Signoff
from archweb_dev.main.utils import make_choice
@@ -144,7 +143,7 @@ def search(request, page=None):
def files(request, pkgid):
pkg = get_object_or_404(Package, id=pkgid)
files = PackageFile.objects.filter(pkg=pkgid)
- return render_response(request, 'packages/files.html', {'pkg':pkg,'files':files})
+ return render_to_response('packages/files.html', RequestContext(request, {'pkg':pkg,'files':files}))
def unflag(request, pkgid):
pkg = get_object_or_404(Package, id=pkgid)
@@ -154,8 +153,8 @@ def unflag(request, pkgid):
def signoffs(request):
packages = Package.objects.filter(repo__name="Testing").order_by("pkgname")
- return render_response(request, 'packages/signoffs.html',
- {'packages': packages})
+ return render_to_response('packages/signoffs.html',
+ RequestContext(request, {'packages': packages}))
def signoff_package(request, arch, pkgname):
pkg = get_object_or_404(Package,
diff --git a/todolists/views.py b/todolists/views.py
index cd02c865..70e55beb 100644
--- a/todolists/views.py
+++ b/todolists/views.py
@@ -1,12 +1,12 @@
from django import forms
from django.http import HttpResponseRedirect
+from django.template import RequestContext
from django.core.mail import send_mail
-from django.shortcuts import get_object_or_404
+from django.shortcuts import get_object_or_404, render_to_response
from django.contrib.auth.decorators import permission_required
from django.views.generic.create_update import delete_object
from django.template import Context, loader
-from archweb_dev.main.utils import render_response
from archweb_dev.main.models import Todolist, TodolistPkg, Package
class TodoListForm(forms.Form):
@@ -36,17 +36,16 @@ def flag(request, listid, pkgid):
def view(request, listid):
list = get_object_or_404(Todolist, id=listid)
- return render_response(
- request,
- 'todolists/view.html',
- {'list':list})
+ return render_to_response('todolists/view.html',
+ RequestContext(request, {'list':list}))
def list(request):
lists = Todolist.objects.order_by('-date_added')
for l in lists:
l.complete = TodolistPkg.objects.filter(
list=l.id,complete=False).count() == 0
- return render_response(request, 'todolists/list.html', {'lists':lists})
+ return render_to_response('todolists/list.html',
+ RequestContext(request, {'lists':lists}))
@permission_required('main.add_todolist')
def add(request):
@@ -71,7 +70,8 @@ def add(request):
'form': form,
'submit_text': 'Create List'
}
- return render_response(request, 'general_form.html', page_dict)
+ return render_to_response('general_form.html',
+ RequestContext(request, page_dict))
@permission_required('main.change_todolist')
def edit(request, list_id):
@@ -109,7 +109,7 @@ def edit(request, list_id):
'form': form,
'submit_text': 'Save List'
}
- return render_response(request, 'general_form.html', page_dict)
+ return render_to_response('general_form.html', RequestContext(request, page_dict))
@permission_required('main.delete_todolist')
def delete_todolist(request, object_id):