Skip to content

5.2.3 regression with TypedModelMeta and mutable override #2823

@sobolevn

Description

@sobolevn

This code causes two errors when mutable-override code is enabled:

from django.db import models

class BlogPost(models.Model):
    body = models.TextField()

    class Meta:
        verbose_name = 'BlogPost'  # E: Covariant override of a mutable attribute (base class "TypedModelMeta" defined the type as "str | _StrPromise", expression has type "str")  [mutable-override]
        verbose_name_plural = 'BlogPosts'  # E: Covariant override of a mutable attribute (base class "TypedModelMeta" defined the type as "str | _StrPromise", expression has type "str")  [mutable-override]

This is not ideal :(
Since there are lots of verbose_name definitions in my project and it does not use _() at all.

Ignoring all lines is rather hard to do manually, disabling this check is also rather sad :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions