Repository: typeddjango/django-stubs

Issue:
Feed - TypeError: 'type' object is not subscriptable
# Bug report

<!--
Hi, thanks for submitting a bug. We appreciate that.

But, we will need some information about what's wrong to help you.
-->

## What's wrong

I get the error `TypeError: 'type' object is not subscriptable` when trying to define the type for the Feed class.

````python
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 134, in inner_run
    self.check(display_num_errors=True)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/core/management/base.py", line 487, in check
    all_issues = checks.run_checks(
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/core/checks/registry.py", line 88, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 14, in check_url_config
    return check_resolver(resolver)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 24, in check_resolver
    return check_method()
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 480, in check
    for pattern in self.url_patterns:
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/utils/functional.py", line 49, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 696, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/utils/functional.py", line 49, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 689, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/adambirds/coding/lifewithvickycouk/lifewithvickycouk/urls.py", line 22, in <module>
    from apps.blog.feeds import LatestPostsFeed
  File "/home/adambirds/coding/lifewithvickycouk/apps/blog/feeds.py", line 29, in <module>
    class LatestPostsFeed(Feed[Post]):
TypeError: 'type' object is not subscriptable
````

<!--
Describe what is not working.

Please, attach a traceback.
We would also appreciate a failing test case.
That is EXTREMELY helpful!
-->

## How it should be

Well we shouldn't get this error as the stubs the for the Feed class state that it should take a model and object(not actually sure what the object should be).

<!-- Describe how it should work. -->

## System information

- OS: Ubuntu WSL2
- `python` version: Python 3.8.10
- `django` version: 4.0.5
- `mypy` version: mypy 0.931
- `django-stubs` version: 1.11.0
- `django-stubs-ext` version: 0.4.0

Feed - TypeError: 'type' object is not subscriptable
# Bug report

<!--
Hi, thanks for submitting a bug. We appreciate that.

But, we will need some information about what's wrong to help you.
-->

## What's wrong

I get the error `TypeError: 'type' object is not subscriptable` when trying to define the type for the Feed class.

````python
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 134, in inner_run
    self.check(display_num_errors=True)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/core/management/base.py", line 487, in check
    all_issues = checks.run_checks(
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/core/checks/registry.py", line 88, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 14, in check_url_config
    return check_resolver(resolver)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 24, in check_resolver
    return check_method()
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 480, in check
    for pattern in self.url_patterns:
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/utils/functional.py", line 49, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 696, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/utils/functional.py", line 49, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/adambirds/coding/lifewithvickycouk/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 689, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/adambirds/coding/lifewithvickycouk/lifewithvickycouk/urls.py", line 22, in <module>
    from apps.blog.feeds import LatestPostsFeed
  File "/home/adambirds/coding/lifewithvickycouk/apps/blog/feeds.py", line 29, in <module>
    class LatestPostsFeed(Feed[Post]):
TypeError: 'type' object is not subscriptable
````

<!--
Describe what is not working.

Please, attach a traceback.
We would also appreciate a failing test case.
That is EXTREMELY helpful!
-->

## How it should be

Well we shouldn't get this error as the stubs the for the Feed class state that it should take a model and object(not actually sure what the object should be).

<!-- Describe how it should work. -->

## System information

- OS: Ubuntu WSL2
- `python` version: Python 3.8.10
- `django` version: 4.0.5
- `mypy` version: mypy 0.931
- `django-stubs` version: 1.11.0
- `django-stubs-ext` version: 0.4.0



Discussion:

Resolving patch:
diff --git a/django_stubs_ext/django_stubs_ext/patch.py b/django_stubs_ext/django_stubs_ext/patch.py
--- a/django_stubs_ext/django_stubs_ext/patch.py
+++ b/django_stubs_ext/django_stubs_ext/patch.py
@@ -3,6 +3,7 @@
 from django import VERSION as VERSION
 from django.contrib.admin import ModelAdmin
 from django.contrib.admin.options import BaseModelAdmin
+from django.contrib.syndication.views import Feed
 from django.core.paginator import Paginator
 from django.db.models.fields import Field
 from django.db.models.manager import BaseManager
@@ -52,6 +53,7 @@ def __repr__(self) -> str:
     MPGeneric(BaseFormSet),
     MPGeneric(BaseModelForm),
     MPGeneric(BaseModelFormSet),
+    MPGeneric(Feed),
     # These types do have native `__class_getitem__` method since django 3.1:
     MPGeneric(QuerySet, (3, 1)),
     MPGeneric(BaseManager, (3, 1)),


Test patch: