When there is only one group, do not force the user to select it in the add_list form.
This commit is contained in:
		
							parent
							
								
									7eb488cfa9
								
							
						
					
					
						commit
						27147637ec
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
					@ -363,6 +363,9 @@ def add_list(request):
 | 
				
			||||||
                messages.error(request,
 | 
					                messages.error(request,
 | 
				
			||||||
                               "There was a problem saving the new list. "
 | 
					                               "There was a problem saving the new list. "
 | 
				
			||||||
                               "Most likely a list with the same name in the same group already exists.")
 | 
					                               "Most likely a list with the same name in the same group already exists.")
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        if request.user.groups.all().count() == 1:
 | 
				
			||||||
 | 
					          form = AddListForm(request.user, initial = {"group": request.user.groups.all()[0]})
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            form = AddListForm(request.user)
 | 
					            form = AddListForm(request.user)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue