Search code examples
pythondjangopylint

How to suppress the 'Invalid class attribute name "id"' pylint warning for Django models?


The default primary key column in Django models is named id, which is not a valid class attribute name according to pylint. How can I suppress the 'Invalid class attribute name "id"' pylint warning for Django model classes (or for the whole project) ?


Solution

  • # pylint: disable=C0103
    

    Put the line in the Models files and it will mute the warnings and if you it at the end of a line of code just disable this message for that line.