]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
urls: Create a project version of bundles
authorDamien Lespiau <damien.lespiau@intel.com>
Thu, 17 Dec 2015 18:33:29 +0000 (18:33 +0000)
committerStephen Finucane <stephen.finucane@intel.com>
Mon, 8 Feb 2016 19:03:37 +0000 (19:03 +0000)
We'd like to have a per-project list of bundles as we present all data
in the context of a single project anyway.

Still keep the instance-wide list bundles around.

v2: Rename the existing 'bundle-list' url to 'user-bundles', as this is
more inkeeping with the other URLs

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
patchwork/templates/patchwork/profile.html
patchwork/urls.py
patchwork/views/bundle.py

index 04fe12ed06599c75339afab6f2a7551cc2ecbb6c..acc90de00d8fed25d6c2741ffd9d80ef896c6e8c 100644 (file)
@@ -107,7 +107,7 @@ address.</p>
  <li><a href="{{ bundle.get_absolute_url }}">{{ bundle.name }}</a></li>
 {% endfor %}
 </ul>
-<p>Visit the <a href="{%url 'bundle-list' %}">bundles
+<p>Visit the <a href="{%url 'user-bundles' %}">bundles
  page</a> to manage your bundles.</p>
 {% else %}
 <p>You have no bundles.</p>
index 550e5675cdcbd01e19cf65fbf8caa3ff5e7a10ab..022b92cf86edaf3db8eb101c6df4d3e8eb2f2f02 100644 (file)
@@ -42,6 +42,8 @@ urlpatterns = [
     url(r'^$', project_views.list, name='project-list'),
     url(r'^project/(?P<project_id>[^/]+)/list/$', patch_views.list,
         name='patch-list'),
+    url(r'^project/(?P<project_id>[^/]+)/bundles/$', bundle_views.bundles,
+        name='bundle-list'),
     url(r'^project/(?P<project_id>[^/]+)/$', project_views.project,
         name='project-detail'),
 
@@ -53,15 +55,15 @@ urlpatterns = [
     url(r'^patch/(?P<patch_id>\d+)/mbox/$', patch_views.mbox,
         name='patch-mbox'),
 
+
     # logged-in user stuff
     url(r'^user/$', user_views.profile, name='user-profile'),
     url(r'^user/todo/$', user_views.todo_lists,
         name='user-todos'),
     url(r'^user/todo/(?P<project_id>[^/]+)/$', user_views.todo_list,
         name='user-todo'),
-
     url(r'^user/bundles/$', bundle_views.bundles,
-        name='bundle-list'),
+        name='user-bundles'),
 
     url(r'^user/link/$', user_views.link,
         name='user-link'),
index 9b88be9b1265ac9a13b91cc22532439e79c9ee0a..8870f2e5bd3a2df87c3fecdc9e60cfd668ec9b15 100644 (file)
@@ -102,12 +102,12 @@ def setbundle(request):
         )
     else:
         return HttpResponseRedirect(
-            django.core.urlresolvers.reverse('bundle-list')
+            django.core.urlresolvers.reverse('user-bundles')
         )
 
 
 @login_required
-def bundles(request):
+def bundles(request, project_id=None):
     context = PatchworkRequestContext(request)
 
     if request.method == 'POST':
@@ -120,12 +120,19 @@ def bundles(request):
                                            id=form.cleaned_data['bundle_id'])
                 bundle.delete()
 
-    bundles = Bundle.objects.filter(owner=request.user)
+    if project_id is None:
+        project = None
+        bundles = Bundle.objects.filter(owner=request.user)
+    else:
+        project = get_object_or_404(Project, linkname=project_id)
+        bundles = Bundle.objects.filter(owner=request.user, project=project)
+
     for bundle in bundles:
         bundle.delete_form = DeleteBundleForm(auto_id=False,
                                               initial={'bundle_id': bundle.id})
 
     context['bundles'] = bundles
+    context['project'] = project
 
     return render_to_response('patchwork/bundles.html', context)