SVN: packages-ng/packages: templates/details.html urls.py views.py
patrys
patrys at pld-linux.org
Fri Apr 3 10:38:58 CEST 2009
Author: patrys
Date: Fri Apr 3 10:38:57 2009
New Revision: 10302
Modified:
packages-ng/packages/templates/details.html
packages-ng/packages/urls.py
packages-ng/packages/views.py
Log:
- make it work with django 1.0
- add installation option
Modified: packages-ng/packages/templates/details.html
==============================================================================
--- packages-ng/packages/templates/details.html (original)
+++ packages-ng/packages/templates/details.html Fri Apr 3 10:38:57 2009
@@ -7,6 +7,8 @@
<p>Group: <a href="{% url packages.views.browse_group package.rpm_group %}">{{ package.rpm_group }}</a></p>
+<p><a href="{% url packages.views.install package.name %}">Install this package</a></p>
+
<h3>Provides:</h3>
<ul>
Modified: packages-ng/packages/urls.py
==============================================================================
--- packages-ng/packages/urls.py (original)
+++ packages-ng/packages/urls.py Fri Apr 3 10:38:57 2009
@@ -6,5 +6,6 @@
(r'^by-provide/(?P<provide>.+)/$', 'packages.views.browse_provides'),
(r'^by-package/(?P<arch>.+)/(?P<name>.+)/(?P<epoch>.+)/(?P<version>.+)/(?P<release>.+)/$', 'packages.views.details'),
(r'^by-source/(?P<source>.+)/$', 'packages.views.browse_source'),
+ (r'^install-package/(?P<name>.+)/$', 'packages.views.install'),
(r'^search/$', 'packages.views.search'),
)
Modified: packages-ng/packages/views.py
==============================================================================
--- packages-ng/packages/views.py (original)
+++ packages-ng/packages/views.py Fri Apr 3 10:38:57 2009
@@ -1,6 +1,7 @@
+from django.http import HttpResponse
from django.shortcuts import get_list_or_404, get_object_or_404
from django.views.generic.simple import direct_to_template
-import django.newforms as forms
+from django import forms
from models import Package
class PkSearchForm(forms.Form):
@@ -34,3 +35,12 @@
def details(request, arch, name, epoch, version, release):
package = get_object_or_404(Package.objects, name = name, epoch = epoch, version = version, release = release, arch = arch)
return direct_to_template(request, 'details.html', {'package': package})
+
+def install(request, name):
+ response = HttpResponse(mimetype = 'application/x-catalog')
+ response['Content-Disposition'] = 'attachment; filename=%s-install.catalog' % name
+ response.write('''[PackageKit Catalog]
+
+InstallPackages(pld)=%s''' % name)
+ return response
+
More information about the pld-cvs-commit
mailing list