From 27147637ec886180259e82e0a8e6fd5a64a1272b Mon Sep 17 00:00:00 2001 From: Lee Phillips Date: Sat, 2 Aug 2014 22:44:56 -0400 Subject: [PATCH] When there is only one group, do not force the user to select it in the add_list form. --- todo/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/todo/views.py b/todo/views.py index f0dd24c..edea8be 100644 --- a/todo/views.py +++ b/todo/views.py @@ -364,7 +364,10 @@ def add_list(request): "There was a problem saving the new list. " "Most likely a list with the same name in the same group already exists.") else: - form = AddListForm(request.user) + if request.user.groups.all().count() == 1: + form = AddListForm(request.user, initial = {"group": request.user.groups.all()[0]}) + else: + form = AddListForm(request.user) return render_to_response('todo/add_list.html', locals(), context_instance=RequestContext(request))