Skip to content

AbstractUser lacks Meta-attribute #2112

Open
@prauscher

Description

@prauscher

Bug report

What's wrong

Since version 5.0.0 (probably since #2000), the following code fails:

from django.contrib.auth.models import AbstractUser

class User(AbstractUser):
    class Meta(AbstractUser.Meta):  # error: Name "AbstractUser.Meta" is not defined
        pass

obviously this example is shortened, but I think you get the Idea. While it is true that a basic Model does not have a Meta-attribute, this is not valid for basically any Subclass for Meta, and using this inheritance is actually the recommended way by django docs:

How is that should be

AbstractUser.Meta should exist for inheritance.

System information

  • OS: Linux (Alpine and Arch tested, but the problem should be valid regardless)
  • python version: 3.12
  • django version: 5.0.4
  • mypy version: 1.10.0
  • django-stubs version: 5.0.0
  • django-stubs-ext version: none

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