summaryrefslogtreecommitdiffstats
path: root/packages/views/display.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-07-24 09:35:55 -0500
committerDan McGee <dan@archlinux.org>2012-07-24 19:57:20 -0500
commit76c37ce3acc7a4af0271c7535d4a33042f7749b5 (patch)
tree4156207a4631dd28d4803d6305dc51bb8388e6db /packages/views/display.py
parentc0bf9e20660cfae7ea8994472555bba23398b598 (diff)
downloadarchweb-76c37ce3acc7a4af0271c7535d4a33042f7749b5.tar.gz
archweb-76c37ce3acc7a4af0271c7535d4a33042f7749b5.zip
Replace deprecated direct_to_template() with render() shortcut
Now that Django actually provides a concise way to use a RequestContext object without instantiating it, we can use that rather than the old function-based generic view that worked well to do the same. Additionally, these function-based generic views will be gone in Django 1.5, so might as well make the move now. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages/views/display.py')
-rw-r--r--packages/views/display.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/packages/views/display.py b/packages/views/display.py
index 31f18c79..585e0e4e 100644
--- a/packages/views/display.py
+++ b/packages/views/display.py
@@ -6,7 +6,6 @@ from urllib import urlencode
from django.http import HttpResponse, Http404
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.timezone import now
-from django.views.generic.simple import direct_to_template
from main.models import Package, PackageFile, Arch, Repo
from mirrors.utils import get_mirror_url_for_download
@@ -33,8 +32,7 @@ def split_package_details(request, name, repo, arch):
'arch': arch,
'packages': pkgs,
}
- return direct_to_template(request, 'packages/packages_list.html',
- context)
+ return render(request, 'packages/packages_list.html', context)
CUTOFF = datetime.timedelta(days=60)
@@ -67,8 +65,7 @@ def details(request, name='', repo='', arch=''):
pkg = Package.objects.select_related(
'arch', 'repo', 'packager').get(pkgname=name,
repo__name__iexact=repo, arch__name=arch)
- return direct_to_template(request, 'packages/details.html',
- {'pkg': pkg, })
+ return render(request, 'packages/details.html', {'pkg': pkg})
except Package.DoesNotExist:
arch_obj = get_object_or_404(Arch, name=arch)
# for arch='any' packages, we can issue a redirect to them if we
@@ -111,7 +108,7 @@ def groups(request, arch=None):
'groups': grps,
'arch': arch,
}
- return direct_to_template(request, 'packages/groups.html', context)
+ return render(request, 'packages/groups.html', context)
def group_details(request, arch, name):
@@ -128,7 +125,7 @@ def group_details(request, arch, name):
'arch': arch,
'packages': pkgs,
}
- return direct_to_template(request, 'packages/packages_list.html', context)
+ return render(request, 'packages/packages_list.html', context)
def files(request, name, repo, arch):
@@ -153,7 +150,7 @@ def files(request, name, repo, arch):
'dir_count': dir_count,
}
template = 'packages/files.html'
- return direct_to_template(request, template, context)
+ return render(request, template, context)
def details_json(request, name, repo, arch):