def get_app_voice(self, item):
        """ App voice
            Returns the js menu compatible voice dict if the user
            can see it, None otherwise
        """
        if item.get('name', None) is None:
            raise ImproperlyConfigured('App menu voices must have a name key')
        if self.check_apps_permission([item.get('name', None)]):
            children = []
            if item.get('models', None) is None:
                for name, model in self.apps_dict[item.get('name')]['models'].items(): # noqa
                    children.append({
                        'type': 'model',
                        'label': model.get('name', ''),
                        'url': model.get('admin_url', '')
                    })
            else:
                for model_item in item.get('models', []):
                    voice = self.get_model_voice(item.get('name'), model_item)
                    if voice:
                        children.append(voice)

            return {
                'type': 'app',
                'label': item.get('label', ''),
                'icon': item.get('icon', None),
                'children': children
            }
        return None
def get_app_voice ( self , item ) : if item . get ( 'name' , None ) is None : raise ImproperlyConfigured ( 'App menu voices must have a name key' ) if self . check_apps_permission ( [ item . get ( 'name' , None ) ] ) : children = [ ] if item . get ( 'models' , None ) is None : for name , model in self . apps_dict [ item . get ( 'name' ) ] [ 'models' ] . items ( ) : children . append ( { 'type' : 'model' , 'label' : model . get ( 'name' , '' ) , 'url' : model . get ( 'admin_url' , '' ) } ) else : for model_item in item . get ( 'models' , [ ] ) : voice = self . get_model_voice ( item . get ( 'name' ) , model_item ) if voice : children . append ( voice ) return { 'type' : 'app' , 'label' : item . get ( 'label' , '' ) , 'icon' : item . get ( 'icon' , None ) , 'children' : children } return None
App voice
            Returns the js menu compatible voice dict if the user
            can see it, None otherwise