From 2ff967c3d9433361b1f086c326f3a473f10373e3 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 28 Dec 2012 09:22:23 -0600 Subject: Todolist URLs map to old_id now, not id This is a short-term fix before adding a slug field to todo lists as we did to news a while back. Signed-off-by: Dan McGee --- todolists/models.py | 2 +- todolists/views.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'todolists') diff --git a/todolists/models.py b/todolists/models.py index c38c564..d19ad92 100644 --- a/todolists/models.py +++ b/todolists/models.py @@ -34,7 +34,7 @@ class Todolist(models.Model): return self.name def get_absolute_url(self): - return '/todo/%i/' % self.id + return '/todo/%i/' % self.old_id def get_full_url(self, proto='https'): '''get a URL suitable for things like email including the domain''' diff --git a/todolists/views.py b/todolists/views.py index 9416439..ccf6536 100644 --- a/todolists/views.py +++ b/todolists/views.py @@ -35,7 +35,7 @@ class TodoListForm(forms.ModelForm): @permission_required('todolists.change_todolistpackage') @never_cache def flag(request, list_id, pkg_id): - todolist = get_object_or_404(Todolist, id=list_id) + todolist = get_object_or_404(Todolist, old_id=list_id) tlpkg = get_object_or_404(TodolistPackage, id=pkg_id) # TODO: none of this; require absolute value on submit if tlpkg.status == TodolistPackage.INCOMPLETE: @@ -53,7 +53,7 @@ def flag(request, list_id, pkg_id): @login_required def view(request, list_id): - todolist = get_object_or_404(Todolist, id=list_id) + todolist = get_object_or_404(Todolist, old_id=list_id) svn_roots = Repo.objects.values_list( 'svn_root', flat=True).order_by().distinct() # we don't hold onto the result, but the objects are the same here, @@ -71,7 +71,7 @@ def view(request, list_id): # really no need for login_required on this one... def list_pkgbases(request, list_id, svn_root): '''Used to make bulk moves of packages a lot easier.''' - todolist = get_object_or_404(Todolist, id=list_id) + todolist = get_object_or_404(Todolist, old_id=list_id) repos = get_list_or_404(Repo, svn_root=svn_root) pkgbases = TodolistPackage.objects.values_list('pkgbase', flat=True).filter( todolist=todolist, repo__in=repos).distinct().order_by('pkgbase') @@ -107,7 +107,7 @@ def add(request): @permission_required('todolists.change_todolist') @never_cache def edit(request, list_id): - todo_list = get_object_or_404(Todolist, id=list_id) + todo_list = get_object_or_404(Todolist, old_id=list_id) if request.POST: form = TodoListForm(request.POST, instance=todo_list) if form.is_valid(): -- cgit v1.2.3-24-g4f1b