Pylint Django model instance of 'str' has no member
You can supress a warning for a certain code block:
class Registration(models.Model): date_added = models.DateTimeField(auto_now_add=True) event = models.ForeignKey(Event, on_delete=models.CASCADE) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) def __str__(self): # pylint: disable=E1101 first_name = self.user.first_name last_name = self.user.last_name return f'{first_name} {last_name}'
Here you will thus only disable E1101
for that specific __str__
method. If you want to re-enable the error in the same block, you can write #pylint: enable=E1101
at the end of the block where you wish to surpress the E1101
warnings.