Remove django-stubs
It's just not quite there yet for a lot of things, and makes certain things a right pain!
This commit is contained in:
parent
30135e53be
commit
d995b412a0
7 changed files with 13 additions and 36 deletions
|
@ -3,10 +3,10 @@
|
||||||
pip-tools
|
pip-tools
|
||||||
|
|
||||||
honcho
|
honcho
|
||||||
django-stubs[compatible-mypy]
|
|
||||||
flake8
|
flake8
|
||||||
isort
|
isort
|
||||||
black
|
black
|
||||||
django-browser-reload
|
django-browser-reload
|
||||||
django-debug-toolbar
|
django-debug-toolbar
|
||||||
types-requests
|
types-requests
|
||||||
|
mypy
|
||||||
|
|
|
@ -15,7 +15,7 @@ certifi==2022.6.15 # via -r requirements/base.txt, requests
|
||||||
charset-normalizer==2.1.0 # via -r requirements/base.txt, requests
|
charset-normalizer==2.1.0 # via -r requirements/base.txt, requests
|
||||||
click==8.1.3 # via -r requirements/base.txt, black, pip-tools, rq
|
click==8.1.3 # via -r requirements/base.txt, black, pip-tools, rq
|
||||||
deprecated==1.2.13 # via -r requirements/base.txt, redis
|
deprecated==1.2.13 # via -r requirements/base.txt, redis
|
||||||
django==4.0.6 # via -r requirements/base.txt, django-browser-reload, django-debug-toolbar, django-filter, django-modelcluster, django-permissionedforms, django-redis, django-rq, django-stubs, django-stubs-ext, django-taggit, django-treebeard, djangorestframework, wagtail
|
django==4.0.6 # via -r requirements/base.txt, django-browser-reload, django-debug-toolbar, django-filter, django-modelcluster, django-permissionedforms, django-redis, django-rq, django-taggit, django-treebeard, djangorestframework, wagtail
|
||||||
django-browser-reload==1.6.0 # via -r requirements/dev.in
|
django-browser-reload==1.6.0 # via -r requirements/dev.in
|
||||||
django-debug-toolbar==3.5.0 # via -r requirements/dev.in
|
django-debug-toolbar==3.5.0 # via -r requirements/dev.in
|
||||||
django-environ==0.9.0 # via -r requirements/base.txt
|
django-environ==0.9.0 # via -r requirements/base.txt
|
||||||
|
@ -24,8 +24,6 @@ django-modelcluster==6.0 # via -r requirements/base.txt, wagtail
|
||||||
django-permissionedforms==0.1 # via -r requirements/base.txt, wagtail
|
django-permissionedforms==0.1 # via -r requirements/base.txt, wagtail
|
||||||
django-redis==5.2.0 # via -r requirements/base.txt
|
django-redis==5.2.0 # via -r requirements/base.txt
|
||||||
django-rq==2.5.1 # via -r requirements/base.txt
|
django-rq==2.5.1 # via -r requirements/base.txt
|
||||||
django-stubs[compatible-mypy]==1.12.0 # via -r requirements/dev.in
|
|
||||||
django-stubs-ext==0.5.0 # via django-stubs
|
|
||||||
django-taggit==2.1.0 # via -r requirements/base.txt, wagtail
|
django-taggit==2.1.0 # via -r requirements/base.txt, wagtail
|
||||||
django-treebeard==4.5.1 # via -r requirements/base.txt, wagtail
|
django-treebeard==4.5.1 # via -r requirements/base.txt, wagtail
|
||||||
djangorestframework==3.13.1 # via -r requirements/base.txt, wagtail
|
djangorestframework==3.13.1 # via -r requirements/base.txt, wagtail
|
||||||
|
@ -41,7 +39,7 @@ l18n==2021.3 # via -r requirements/base.txt, wagtail
|
||||||
lxml==4.9.1 # via -r requirements/base.txt
|
lxml==4.9.1 # via -r requirements/base.txt
|
||||||
mccabe==0.6.1 # via flake8
|
mccabe==0.6.1 # via flake8
|
||||||
more-itertools==8.13.0 # via -r requirements/base.txt
|
more-itertools==8.13.0 # via -r requirements/base.txt
|
||||||
mypy==0.961 # via django-stubs
|
mypy==0.971 # via -r requirements/dev.in
|
||||||
mypy-extensions==0.4.3 # via black, mypy
|
mypy-extensions==0.4.3 # via black, mypy
|
||||||
openpyxl==3.0.10 # via -r requirements/base.txt, tablib
|
openpyxl==3.0.10 # via -r requirements/base.txt, tablib
|
||||||
packaging==21.3 # via -r requirements/base.txt, build, redis
|
packaging==21.3 # via -r requirements/base.txt, build, redis
|
||||||
|
@ -63,12 +61,10 @@ soupsieve==2.3.2.post1 # via -r requirements/base.txt, beautifulsoup4
|
||||||
sqlparse==0.4.2 # via -r requirements/base.txt, django, django-debug-toolbar
|
sqlparse==0.4.2 # via -r requirements/base.txt, django, django-debug-toolbar
|
||||||
tablib[xls,xlsx]==3.2.1 # via -r requirements/base.txt, wagtail
|
tablib[xls,xlsx]==3.2.1 # via -r requirements/base.txt, wagtail
|
||||||
telepath==0.2 # via -r requirements/base.txt, wagtail
|
telepath==0.2 # via -r requirements/base.txt, wagtail
|
||||||
tomli==2.0.1 # via black, build, django-stubs, mypy
|
tomli==2.0.1 # via black, build, mypy
|
||||||
types-pytz==2022.1.2 # via django-stubs
|
|
||||||
types-pyyaml==6.0.11 # via django-stubs
|
|
||||||
types-requests==2.28.5 # via -r requirements/dev.in
|
types-requests==2.28.5 # via -r requirements/dev.in
|
||||||
types-urllib3==1.26.17 # via types-requests
|
types-urllib3==1.26.17 # via types-requests
|
||||||
typing-extensions==4.3.0 # via django-stubs, django-stubs-ext, mypy
|
typing-extensions==4.3.0 # via mypy
|
||||||
urllib3==1.26.11 # via -r requirements/base.txt, requests
|
urllib3==1.26.11 # via -r requirements/base.txt, requests
|
||||||
wagtail==3.0.1 # via -r requirements/base.txt, wagtail-draftail-snippet
|
wagtail==3.0.1 # via -r requirements/base.txt, wagtail-draftail-snippet
|
||||||
wagtail-draftail-snippet==0.4.1 # via -r requirements/base.txt
|
wagtail-draftail-snippet==0.4.1 # via -r requirements/base.txt
|
||||||
|
|
|
@ -7,10 +7,6 @@ ignore_missing_imports = True
|
||||||
disallow_untyped_calls = True
|
disallow_untyped_calls = True
|
||||||
disallow_untyped_defs = True
|
disallow_untyped_defs = True
|
||||||
disallow_incomplete_defs = True
|
disallow_incomplete_defs = True
|
||||||
plugins = mypy_django_plugin.main
|
|
||||||
|
|
||||||
[mypy.plugins.django-stubs]
|
|
||||||
django_settings_module = "website.settings"
|
|
||||||
|
|
||||||
[isort]
|
[isort]
|
||||||
multi_line_output=3
|
multi_line_output=3
|
||||||
|
|
|
@ -46,9 +46,7 @@ class BlogListPage(BaseContentMixin, RoutablePageMixin, BasePage): # type: igno
|
||||||
return [TocEntry(post_month, post_month, 0, []) for post_month in post_months]
|
return [TocEntry(post_month, post_month, 0, []) for post_month in post_months]
|
||||||
|
|
||||||
def get_blog_posts(self) -> PageQuerySet:
|
def get_blog_posts(self) -> PageQuerySet:
|
||||||
return BlogPostPage.objects.descendant_of( # type:ignore[attr-defined]
|
return BlogPostPage.objects.descendant_of(self).live()
|
||||||
self
|
|
||||||
).live()
|
|
||||||
|
|
||||||
def get_context(self, request: HttpRequest) -> dict:
|
def get_context(self, request: HttpRequest) -> dict:
|
||||||
context = super().get_context(request)
|
context = super().get_context(request)
|
||||||
|
@ -117,9 +115,7 @@ class BlogPostTagPage(BaseContentMixin, RoutablePageMixin, BasePage): # type: i
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_blog_posts(self) -> PageQuerySet:
|
def get_blog_posts(self) -> PageQuerySet:
|
||||||
blog_list_page = (
|
blog_list_page = BlogListPage.objects.all().live().get()
|
||||||
BlogListPage.objects.all().live().get() # type:ignore[attr-defined]
|
|
||||||
)
|
|
||||||
return blog_list_page.get_blog_posts().filter(tags=self).order_by("-date")
|
return blog_list_page.get_blog_posts().filter(tags=self).order_by("-date")
|
||||||
|
|
||||||
def get_context(self, request: HttpRequest) -> dict:
|
def get_context(self, request: HttpRequest) -> dict:
|
||||||
|
@ -150,12 +146,8 @@ class BlogCollectionListPage(BaseContentMixin, BasePage): # type: ignore[misc]
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_collections(self) -> PageQuerySet:
|
def get_collections(self) -> PageQuerySet:
|
||||||
blog_list_page = (
|
blog_list_page = BlogListPage.objects.all().live().get()
|
||||||
BlogListPage.objects.all().live().get() # type:ignore[attr-defined]
|
return BlogCollectionPage.objects.child_of(blog_list_page).live()
|
||||||
)
|
|
||||||
return BlogCollectionPage.objects.child_of( # type:ignore[attr-defined]
|
|
||||||
blog_list_page
|
|
||||||
).live()
|
|
||||||
|
|
||||||
def get_context(self, request: HttpRequest) -> dict:
|
def get_context(self, request: HttpRequest) -> dict:
|
||||||
context = super().get_context(request)
|
context = super().get_context(request)
|
||||||
|
@ -176,9 +168,7 @@ class BlogCollectionPage(BaseContentMixin, BasePage): # type: ignore[misc]
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_blog_posts(self) -> PageQuerySet:
|
def get_blog_posts(self) -> PageQuerySet:
|
||||||
return BlogPostPage.objects.child_of( # type:ignore[attr-defined]
|
return BlogPostPage.objects.child_of(self).order_by("-date")
|
||||||
self
|
|
||||||
).order_by("-date")
|
|
||||||
|
|
||||||
def get_context(self, request: HttpRequest) -> dict:
|
def get_context(self, request: HttpRequest) -> dict:
|
||||||
context = super().get_context(request)
|
context = super().get_context(request)
|
||||||
|
|
|
@ -15,9 +15,7 @@ class BlogPostTagsMenuItem(MenuItem):
|
||||||
def is_shown(self, request: HttpRequest) -> bool:
|
def is_shown(self, request: HttpRequest) -> bool:
|
||||||
if not self.url:
|
if not self.url:
|
||||||
blog_post_tag_list_id = (
|
blog_post_tag_list_id = (
|
||||||
BlogPostTagListPage.objects.live() # type:ignore[attr-defined]
|
BlogPostTagListPage.objects.live().values_list("id", flat=True).first()
|
||||||
.values_list("id", flat=True)
|
|
||||||
.first()
|
|
||||||
)
|
)
|
||||||
self.url = (
|
self.url = (
|
||||||
reverse("wagtailadmin_explore", args=[blog_post_tag_list_id])
|
reverse("wagtailadmin_explore", args=[blog_post_tag_list_id])
|
||||||
|
|
|
@ -91,7 +91,7 @@ class BaseContentMixin(models.Model):
|
||||||
@cached_property
|
@cached_property
|
||||||
def hero_image_url(self) -> Optional[str]:
|
def hero_image_url(self) -> Optional[str]:
|
||||||
if self.hero_unsplash_photo_id is not None:
|
if self.hero_unsplash_photo_id is not None:
|
||||||
return self.hero_unsplash_photo.get_hero_image_url() # type: ignore
|
return self.hero_unsplash_photo.get_hero_image_url()
|
||||||
elif self.hero_image_id is not None:
|
elif self.hero_image_id is not None:
|
||||||
return generate_image_url(self.hero_image, "width-1200")
|
return generate_image_url(self.hero_image, "width-1200")
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -23,9 +23,6 @@ class HomePage(BasePage):
|
||||||
def get_context(self, request: HttpRequest) -> dict:
|
def get_context(self, request: HttpRequest) -> dict:
|
||||||
context = super().get_context(request)
|
context = super().get_context(request)
|
||||||
context["latest_blog_post"] = (
|
context["latest_blog_post"] = (
|
||||||
BlogPostPage.objects.live() # type:ignore[attr-defined]
|
BlogPostPage.objects.live().defer_streamfields().order_by("-date").first()
|
||||||
.defer_streamfields()
|
|
||||||
.order_by("-date")
|
|
||||||
.first()
|
|
||||||
)
|
)
|
||||||
return context
|
return context
|
||||||
|
|
Loading…
Reference in a new issue