def create_document_editor_user():
 User = get_user_model()
 (user, user_created) = User.objects.get_or_create(username='conantheeditor', defaults=dict(email='user_%s@example.com', is_active=True, is_staff=False, is_superuser=False))
 if user_created:
  user.set_password('testpass')
  user.groups = [create_document_editor_group()]
  user.save()
 return user

def create_document_editor_user ( ) : User = get_user_model ( ) ( user , user_created ) = User . objects . get_or_create ( username = 'conantheeditor' , defaults = dict ( email = 'user_%s@example.com' , is_active = True , is_staff = False , is_superuser = False ) ) if user_created : user . set_password ( 'testpass' ) user . groups = [ create_document_editor_group ( ) ] user . save ( ) return user
get or create a user empowered with document editing .