Skip to content

MultipleObjectMixin and SingleObjectMixin has incompatible types for queryset and context_object_name #873

Closed as not planned
@PetrDlouhy

Description

@PetrDlouhy

Bug report

What's wrong

I have view class in django-hordak defined as:

class AccountTransactionsView(LoginRequiredMixin, SingleObjectMixin, ListView):
    ...

Which gives the following mypy errors:

# mypy .
hordak/views/accounts.py:86: error: Definition of "context_object_name" in base class "SingleObjectMixin" is incompatible with definition in base class "MultipleObjectMixin"
hordak/views/accounts.py:86: error: Definition of "queryset" in base class "SingleObjectMixin" is incompatible with definition in base class "MultipleObjectMixin"
Found 2 errors in 1 file (checked 56 source files)

How is that should be

Types for queryset and context_object_name should be made less strict to be compatible similar to solution of issue #152

System information

  • OS: Ubuntu
  • python version: 3.9.7
  • django version: 4.0.2
  • mypy version: 0.931
  • django-stubs version: 1.9.0
  • django-stubs-ext version: 0.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions