diff --git a/todo/forms.py b/todo/forms.py
index 3aea30b..0986aa7 100644
--- a/todo/forms.py
+++ b/todo/forms.py
@@ -17,7 +17,7 @@ class AddTaskListForm(ModelForm):
class Meta:
model = TaskList
- exclude = ['created_date', ]
+ exclude = ['created_date', 'slug', ]
class AddEditTaskForm(ModelForm):
diff --git a/todo/templates/todo/add_list.html b/todo/templates/todo/add_list.html
index 3eaaa46..610d918 100644
--- a/todo/templates/todo/add_list.html
+++ b/todo/templates/todo/add_list.html
@@ -13,12 +13,6 @@
The full display name for this list.
-
-
-
-
- To be used in URL for this list e.g. 'ux-tasks'. All lowercase, no spaces.
-
{{form.group}}
diff --git a/todo/views.py b/todo/views.py
index 4d5c3cb..069446b 100644
--- a/todo/views.py
+++ b/todo/views.py
@@ -12,8 +12,9 @@ from django.db.models import Q
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render, redirect
from django.template.loader import render_to_string
-from django.views.decorators.csrf import csrf_exempt
from django.utils import timezone
+from django.utils.text import slugify
+from django.views.decorators.csrf import csrf_exempt
from todo.forms import AddTaskListForm, AddEditTaskForm, AddExternalTaskForm, SearchForm
from todo.models import Task, TaskList, Comment
@@ -280,7 +281,9 @@ def add_list(request) -> HttpResponse:
form = AddTaskListForm(request.user, request.POST)
if form.is_valid():
try:
- form.save()
+ newlist = form.save(commit=False)
+ newlist.slug = slugify(newlist.name)
+ newlist.save()
messages.success(request, "A new list has been added.")
return redirect('todo:lists')