Add URLPattern options to django.url.conf since they were missing. (#583)

* Add URLPattern options to django.url.conf since they were missing.

* Fix some wording in the contribution guide & fix a reference to Django version 3.0, which has since been replaced by 3.1 as new stable version.

* My bad - I was misreading the type hints a bit here. Fix tests.

* We need to specify the List[Union[URLResolver, URLPattern]] upfront, since those don't accept List[URLResolver] as argument.

* Add test to ensure that path() accepts a mix of URLPatterns & URLResolvers.

Co-authored-by: LanDinh <coding+sourcetree@khaleesi.ninja>
This commit is contained in:
LanDinh
2021-04-10 17:01:40 +02:00
committed by GitHub
parent 9beb5327de
commit ceb08f1804
5 changed files with 14 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ from django.db.models.base import Model
from django.db.models.query import QuerySet
from django.http.response import HttpResponse
from django.template.response import TemplateResponse
from django.urls.resolvers import URLResolver
from django.urls import URLResolver, URLPattern
from django.utils.functional import LazyObject
from django.core.checks import CheckMessage
@@ -67,7 +67,7 @@ class AdminSite:
def admin_view(self, view: Callable, cacheable: bool = ...) -> Callable: ...
def get_urls(self) -> List[URLResolver]: ...
@property
def urls(self) -> Tuple[List[URLResolver], str, str]: ...
def urls(self) -> Tuple[List[Union[URLResolver, URLPattern]], str, str]: ...
def each_context(self, request: WSGIRequest) -> Dict[str, Any]: ...
def password_change(
self, request: WSGIRequest, extra_context: Optional[Dict[str, Any]] = ...