diff --git a/django-stubs/contrib/syndication/views.pyi b/django-stubs/contrib/syndication/views.pyi index b59b55137..ca805cd23 100644 --- a/django-stubs/contrib/syndication/views.pyi +++ b/django-stubs/contrib/syndication/views.pyi @@ -1,27 +1,55 @@ -from typing import Any, Dict, List +import datetime +from typing import Any, Callable, Dict, Generic, Iterable, Optional, Type, TypeVar, Union from django.core.exceptions import ObjectDoesNotExist from django.core.handlers.wsgi import WSGIRequest -from django.db.models.base import Model from django.http.response import HttpResponse from django.utils.feedgenerator import Enclosure, SyndicationFeed -from django.utils.safestring import SafeText def add_domain(domain: str, url: str, secure: bool = ...) -> str: ... class FeedDoesNotExist(ObjectDoesNotExist): ... -class Feed: - feed_type: Any = ... - title_template: Any = ... - description_template: Any = ... +_Item = TypeVar("_Item") +_Object = TypeVar("_Object") + +class Feed(Generic[_Item, _Object]): + feed_type: Type[SyndicationFeed] = ... + title_template: Optional[str] = ... + description_template: Optional[str] = ... + language: Optional[str] = ... + title: Any = ... + link: Any = ... + feed_url: Any = ... + feed_guid: Any = ... + description: Any = ... + author_name: Any = ... + author_email: Any = ... + author_link: Any = ... + categories: Any = ... + feed_copyright: Any = ... + ttl: Any = ... + items: Any = ... + item_title: Any = ... + item_description: Any = ... + item_link: Any = ... + item_guid: Any = ... + item_guid_is_permalink: Any = ... + item_author_name: Any = ... + item_author_email: Any = ... + item_author_link: Any = ... + item_enclosures: Any = ... + item_enclosure_url: Any = ... + item_enclosure_length: Any = ... + item_enclosure_mime_type: Any = ... + item_pubdate: Any = ... + item_updateddate: Any = ... + item_categories: Any = ... + item_copyright: Any = ... + item_comments: Any = ... def __call__(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... - def item_title(self, item: Model) -> SafeText: ... - def item_description(self, item: Model) -> str: ... - def item_link(self, item: Model) -> str: ... - def item_enclosures(self, item: Model) -> List[Enclosure]: ... - def feed_extra_kwargs(self, obj: None) -> Dict[Any, Any]: ... - def item_extra_kwargs(self, item: Model) -> Dict[Any, Any]: ... - def get_object(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> Any: ... + def get_object(self, request: WSGIRequest, *args: Any, **kwargs: Any) -> Optional[_Object]: ... + def feed_extra_kwargs(self, obj: _Object) -> Dict[Any, Any]: ... + def item_extra_kwargs(self, item: _Item) -> Dict[Any, Any]: ... def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: ... - def get_feed(self, obj: None, request: WSGIRequest) -> SyndicationFeed: ... + def get_feed(self, obj: _Object, request: WSGIRequest) -> SyndicationFeed: ...