pylint-django icon indicating copy to clipboard operation
pylint-django copied to clipboard

E0307 false positives when returning model fields

Open sevdog opened this issue 2 years ago • 0 comments

When using pylint django if in model __str__ method a field is returned pylint cannot recognize that this field should be a string.

from django.db import models

class Model(models.Model):
    field = models.CharField(max_length=10)

    def __str__(self):  # E0307
        return self.field

It would be nice if this plugin was able to detect if a field which inherits from CharField or TextField is used and suppress this error.

sevdog avatar Sep 01 '23 08:09 sevdog