Try to guess first/last name when making new rattail user via command line
This commit is contained in:
		
							parent
							
								
									3d1154b5a9
								
							
						
					
					
						commit
						6438dcf51a
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1147,7 +1147,11 @@ class MakeUser(Subcommand):
 | 
			
		|||
        if args.admin:
 | 
			
		||||
            user.roles.append(auth.administrator_role(session))
 | 
			
		||||
        if args.full_name:
 | 
			
		||||
            user.person = model.Person(display_name=args.full_name)
 | 
			
		||||
            kwargs = {'display_name': args.full_name}
 | 
			
		||||
            words = args.full_name.split()
 | 
			
		||||
            if len(words) == 2:
 | 
			
		||||
                kwargs.update({'first_name': words[0], 'last_name': words[1]})
 | 
			
		||||
            user.person = model.Person(**kwargs)
 | 
			
		||||
        session.add(user)
 | 
			
		||||
        session.commit()
 | 
			
		||||
        session.close()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue