diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2008-09-23 20:52:53 +1000 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2008-09-23 20:52:53 +1000 |
commit | 750c03f854ace16cd013c189369aa0cf9d3bdd9d (patch) | |
tree | 91415c0436e8e901461fe65a88a3504b102b2e57 /apps/patchwork/views/bundle.py | |
parent | dff684304a35c14e23d89783d18e1664222b3fcb (diff) | |
download | patchwork-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.py | 25 |
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)] |