summaryrefslogtreecommitdiffstats
path: root/apps/patchwork/views/bundle.py
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2008-09-23 20:52:53 +1000
committerJeremy Kerr <jk@ozlabs.org>2008-09-23 20:52:53 +1000
commit750c03f854ace16cd013c189369aa0cf9d3bdd9d (patch)
tree91415c0436e8e901461fe65a88a3504b102b2e57 /apps/patchwork/views/bundle.py
parentdff684304a35c14e23d89783d18e1664222b3fcb (diff)
downloadpatchwork-750c03f854ace16cd013c189369aa0cf9d3bdd9d.tar.bz2
patchwork-750c03f854ace16cd013c189369aa0cf9d3bdd9d.tar.xz
[views] Restructure profile view, simplify bundle access
Make bundles more like todo lists - the list itself has its own page, accessible from the top user links. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps/patchwork/views/bundle.py')
-rw-r--r--apps/patchwork/views/bundle.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/apps/patchwork/views/bundle.py b/apps/patchwork/views/bundle.py
index d8c868e..5f990c4 100644
--- a/apps/patchwork/views/bundle.py
+++ b/apps/patchwork/views/bundle.py
@@ -25,7 +25,7 @@ from django.http import HttpResponse, HttpResponseRedirect
import django.core.urlresolvers
from patchwork.models import Patch, Bundle, Project
from patchwork.utils import get_patch_ids
-from patchwork.forms import BundleForm
+from patchwork.forms import BundleForm, DeleteBundleForm
from patchwork.views import generic_list
from patchwork.filters import DelegateFilter
from patchwork.paginator import Paginator
@@ -101,6 +101,29 @@ def setbundle(request):
)
@login_required
+def bundles(request):
+ context = PatchworkRequestContext(request)
+
+ if request.method == 'POST':
+ form_name = request.POST.get('form_name', '')
+
+ if form_name == DeleteBundleForm.name:
+ form = DeleteBundleForm(request.POST)
+ if form.is_valid():
+ bundle = get_object_or_404(Bundle,
+ id = form.cleaned_data['bundle_id'])
+ bundle.delete()
+
+ bundles = Bundle.objects.filter(owner = request.user)
+ for bundle in bundles:
+ bundle.delete_form = DeleteBundleForm(auto_id = False,
+ initial = {'bundle_id': bundle.id})
+
+ context['bundles'] = bundles
+
+ return render_to_response('patchwork/bundles.html', context)
+
+@login_required
def bundle(request, bundle_id):
bundle = get_object_or_404(Bundle, id = bundle_id)
filter_settings = [(DelegateFilter, DelegateFilter.AnyDelegate)]