django-stubs: error: Definition of "_meta" in base class "PermissionsMixin" is incompatible with definition in base class "AbstractBaseUser"

Bug report

What’s wrong

We have defined a custom AuthUser model in our project like:

from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin

class AuthUser(PermissionsMixin, AbstractBaseUser):
    class Meta:
        verbose_name = _('Auth User')
        abstract = False
        db_table = 'auth_user'

mypy gives an error:

myproject/models/auth.py:3: error: Definition of "_meta" in base class "PermissionsMixin" is incompatible with definition in base class "AbstractBaseUser"

(from the class AuthUser(PermissionsMixin, AbstractBaseUser): line)

The slightly weird part is Django’s PermissionMixin and AbstractBaseUser both have an identical Meta:

    class Meta:
        abstract = True

How is that should be

No error

System information

  • OS:
  • python version: 3.8.3
  • django version: 2.2.12
  • mypy version: 0.782
  • django-stubs version: 1.5.0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 20 (9 by maintainers)

Most upvoted comments

Hey all, is there any update for this issue? I’m having the same problem.

I’m still having this issue too. How can we fix it? Or at least set it to ignore if you aren’t going to.

mypy 0.950 django-stubs 1.11.0 Still having this issue