[Answer]-PyCharm doesn't understand custom Manager of model

1👍

This seems to be a problem of PyCharm. Writing an auto completion for Python is really a hard task, especially for things like Django Models, which uses Meta Classes and other nasty stuff.

However it is possible to complete, and it seems not so difficult, for your example my autocompletion ( https://github.com/davidhalter/jedi/tree/dev, work in progress, don’t use it yet) is able to complete it:

Completing TokenType.objects. :

update                
by_id                 
by_lookup             
create                
use_for_related_fields

Completing TokenType.:

__metaclass__                 
__hash__                      
_get_next_or_previous_in_order
__ne__                        
date_error_message            
description                   
_perform_date_checks          
delete                        
clean                         
objects                       
unique_error_message          
_set_pk_val                   
_deferred                     
save_base                     
pk                            
serializable_value            
full_clean                    
__init__                      
code                          
save                          
__str__                       
validate_unique               
clean_fields                  
__repr__                      
_perform_unique_checks        
__reduce__                    
_get_unique_checks            
prepare_database_save         
_get_pk_val                   
__eq__                        
lookups                       
_get_next_or_previous_by_FIELD
Meta                          
_get_FIELD_display    

As far as I’m concerned, PyCharm is Closed Source, so I think you’ll have to talk to the PyCharm developers.

Leave a comment