#NEWLINE# def get_context_data( self , form , **kwargs ) : #NEWLINE# #INDENT# "\n        Adds user's default and backup OTP devices to the context.\n        " #NEWLINE# context = super ( LoginView , self ) . get_context_data ( form , ** kwargs ) #NEWLINE# if ( self . steps . current == 'token' ) : #NEWLINE# #INDENT# context [ 'device' ] = self . get_device ( ) #NEWLINE# context [ 'other_devices' ] = [ phone for phone in backup_phones ( self . get_user ( ) ) if ( phone != self . get_device ( ) ) ] #NEWLINE# try : #NEWLINE# #INDENT# context [ 'backup_tokens' ] = self . get_user ( ) . staticdevice_set . get ( name = 'backup' ) . token_set . count ( ) #NEWLINE# #UNINDENT# except StaticDevice . DoesNotExist : #NEWLINE# #INDENT# context [ 'backup_tokens' ] = 0 #NEWLINE# #UNINDENT# #UNINDENT# context [ 'cancel_url' ] = settings . LOGOUT_URL #NEWLINE# return context