summaryrefslogtreecommitdiff
path: root/todolists/views.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-12-28 10:14:08 -0600
committerDan McGee <dan@archlinux.org>2012-12-28 14:48:29 -0600
commit29be1e06032ad8a0a38921b9e04be888141881b1 (patch)
tree78f16081097a39c00117e1b688973967a75d7467 /todolists/views.py
parent563a618e697c918c2a76c63a5217047a8d3c1489 (diff)
Set slug on todolist creation
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'todolists/views.py')
-rw-r--r--todolists/views.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/todolists/views.py b/todolists/views.py
index 29f543c2..413d8675 100644
--- a/todolists/views.py
+++ b/todolists/views.py
@@ -3,13 +3,16 @@ import json
from django import forms
from django.http import HttpResponse
from django.core.mail import send_mail
-from django.shortcuts import get_list_or_404, get_object_or_404, redirect, render
+from django.shortcuts import (get_list_or_404, get_object_or_404,
+ redirect, render)
from django.db import transaction
from django.views.decorators.cache import never_cache
from django.views.generic import DeleteView
from django.template import Context, loader
+from django.template.defaultfilters import slugify
from main.models import Package, Repo
+from main.utils import find_unique_slug
from packages.utils import attach_maintainers
from .models import Todolist, TodolistPackage
from .utils import get_annotated_todolists
@@ -142,9 +145,10 @@ class DeleteTodolist(DeleteView):
def create_todolist_packages(form, creator=None):
packages = form.packages()
if creator:
- # todo list is new
+ # todo list is new, populate creator and slug fields
todolist = form.save(commit=False)
todolist.creator = creator
+ todolist.slug = find_unique_slug(Todolist, todolist.name)
todolist.save()
old_packages = []