Fix some mypy typing issues
This commit is contained in:
parent
f01e4c72ab
commit
c6f546d080
@ -164,11 +164,17 @@ class Member(models.Model):
|
|||||||
db_table = "members"
|
db_table = "members"
|
||||||
ordering = ("first_name", "last_name")
|
ordering = ("first_name", "last_name")
|
||||||
|
|
||||||
def sanitized_mailbox(self, name_ext: str = "", use_volunteer=False):
|
def sanitized_mailbox(self, name_ext: str = "", use_volunteer=False) -> str:
|
||||||
if use_volunteer and self.volunteer_email:
|
if use_volunteer and self.volunteer_email:
|
||||||
email = self.volunteer_email
|
email = self.volunteer_email
|
||||||
else:
|
elif self.email:
|
||||||
email = self.email
|
email = self.email
|
||||||
|
else:
|
||||||
|
raise Exception(f"No Email Address for user: {self.uid}")
|
||||||
|
|
||||||
|
if not self.account_name:
|
||||||
|
return email
|
||||||
|
|
||||||
return django.core.mail.message.sanitize_address(
|
return django.core.mail.message.sanitize_address(
|
||||||
(self.account_name + name_ext, email), settings.DEFAULT_CHARSET
|
(self.account_name + name_ext, email), settings.DEFAULT_CHARSET
|
||||||
)
|
)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from django.core import mail
|
from django.core import mail
|
||||||
from django.contrib import admin, messages
|
from django.contrib import admin, messages
|
||||||
|
from django.db.models import Value
|
||||||
from django.db.models.functions import Now, Concat, LPad
|
from django.db.models.functions import Now, Concat, LPad
|
||||||
|
|
||||||
from .models import (
|
from .models import (
|
||||||
@ -16,7 +17,7 @@ from .certification_emails import all_certification_emails
|
|||||||
|
|
||||||
|
|
||||||
@admin.register(Department)
|
@admin.register(Department)
|
||||||
class Department(admin.ModelAdmin):
|
class DepartmentAdmin(admin.ModelAdmin):
|
||||||
search_fields = ["name"]
|
search_fields = ["name"]
|
||||||
list_display = [
|
list_display = [
|
||||||
"name",
|
"name",
|
||||||
@ -87,9 +88,9 @@ class CertificationAdmin(admin.ModelAdmin):
|
|||||||
description="Certification Version",
|
description="Certification Version",
|
||||||
ordering=(
|
ordering=(
|
||||||
Concat(
|
Concat(
|
||||||
LPad("certification_version__major", 4, 0),
|
LPad("certification_version__major", 4, Value("0")),
|
||||||
LPad("certification_version__minor", 4, 0),
|
LPad("certification_version__minor", 4, Value("0")),
|
||||||
LPad("certification_version__patch", 4, 0),
|
LPad("certification_version__patch", 4, Value("0")),
|
||||||
"certification_version__prerelease",
|
"certification_version__prerelease",
|
||||||
"certification_version__approval_date",
|
"certification_version__approval_date",
|
||||||
)
|
)
|
||||||
|
34
pdm.lock
34
pdm.lock
@ -1,3 +1,6 @@
|
|||||||
|
# This file is @generated by PDM.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asgiref"
|
name = "asgiref"
|
||||||
version = "3.5.2"
|
version = "3.5.2"
|
||||||
@ -214,6 +217,31 @@ dependencies = [
|
|||||||
"pytz",
|
"pytz",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "djangorestframework-stubs"
|
||||||
|
version = "1.8.0"
|
||||||
|
requires_python = ">=3.7"
|
||||||
|
summary = "PEP-484 stubs for django-rest-framework"
|
||||||
|
dependencies = [
|
||||||
|
"django-stubs>=1.13.0",
|
||||||
|
"mypy>=0.980",
|
||||||
|
"requests>=2.0.0",
|
||||||
|
"types-PyYAML>=5.4.3",
|
||||||
|
"types-requests>=0.1.12",
|
||||||
|
"typing-extensions>=3.10.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "djangorestframework-stubs"
|
||||||
|
version = "1.8.0"
|
||||||
|
extras = ["compatible-mypy"]
|
||||||
|
requires_python = ">=3.7"
|
||||||
|
summary = "PEP-484 stubs for django-rest-framework"
|
||||||
|
dependencies = [
|
||||||
|
"djangorestframework-stubs==1.8.0",
|
||||||
|
"mypy<0.1000,>=0.991",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "djlint"
|
name = "djlint"
|
||||||
version = "1.19.6"
|
version = "1.19.6"
|
||||||
@ -627,7 +655,7 @@ summary = "Zopfli module for python"
|
|||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
lock_version = "4.1"
|
lock_version = "4.1"
|
||||||
content_hash = "sha256:7c2b758527ac921e68c591216d325c06ebcf7aa3903366e23a02f02c37fd7241"
|
content_hash = "sha256:5c8ae9be2445282d6bbc312346977f292dcb248cb11bd98a15c1caa7c517f3c1"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
"asgiref 3.5.2" = [
|
"asgiref 3.5.2" = [
|
||||||
@ -913,6 +941,10 @@ content_hash = "sha256:7c2b758527ac921e68c591216d325c06ebcf7aa3903366e23a02f02c3
|
|||||||
{url = "https://files.pythonhosted.org/packages/8e/53/5b2a002c5ebafd60dff1e1945a7d63dee40155830997439a9ba324f0fd50/djangorestframework-3.14.0.tar.gz", hash = "sha256:579a333e6256b09489cbe0a067e66abe55c6595d8926be6b99423786334350c8"},
|
{url = "https://files.pythonhosted.org/packages/8e/53/5b2a002c5ebafd60dff1e1945a7d63dee40155830997439a9ba324f0fd50/djangorestframework-3.14.0.tar.gz", hash = "sha256:579a333e6256b09489cbe0a067e66abe55c6595d8926be6b99423786334350c8"},
|
||||||
{url = "https://files.pythonhosted.org/packages/ff/4b/3b46c0914ba4b7546a758c35fdfa8e7f017fcbe7f23c878239e93623337a/djangorestframework-3.14.0-py3-none-any.whl", hash = "sha256:eb63f58c9f218e1a7d064d17a70751f528ed4e1d35547fdade9aaf4cd103fd08"},
|
{url = "https://files.pythonhosted.org/packages/ff/4b/3b46c0914ba4b7546a758c35fdfa8e7f017fcbe7f23c878239e93623337a/djangorestframework-3.14.0-py3-none-any.whl", hash = "sha256:eb63f58c9f218e1a7d064d17a70751f528ed4e1d35547fdade9aaf4cd103fd08"},
|
||||||
]
|
]
|
||||||
|
"djangorestframework-stubs 1.8.0" = [
|
||||||
|
{url = "https://files.pythonhosted.org/packages/4a/f9/700316d813372dc2db720ca06a5fb74b872dd6d39a7d523217cc01dd262f/djangorestframework-stubs-1.8.0.tar.gz", hash = "sha256:9abf25d54a11930fe0fc97d0769e1ed58db8dfc134b1fdbd76bbbaaa932ef180"},
|
||||||
|
{url = "https://files.pythonhosted.org/packages/b2/5f/086c6c835979a8cd684aa232a2324935214303b37b7c8c31540e136f15ad/djangorestframework_stubs-1.8.0-py3-none-any.whl", hash = "sha256:690739501b06c1b5a7b25e1b50abb9719abebef2e02bcad8c5a5464e5cd52543"},
|
||||||
|
]
|
||||||
"djlint 1.19.6" = [
|
"djlint 1.19.6" = [
|
||||||
{url = "https://files.pythonhosted.org/packages/1b/28/e0100f86e5b054ab3c169a612ab2fdca5cfc8ceb92c34420a8ba488de43e/djlint-1.19.6-py3-none-any.whl", hash = "sha256:e7fd305f93057cd205a29999b840210db70789e4cf277625f148447ad7de62b1"},
|
{url = "https://files.pythonhosted.org/packages/1b/28/e0100f86e5b054ab3c169a612ab2fdca5cfc8ceb92c34420a8ba488de43e/djlint-1.19.6-py3-none-any.whl", hash = "sha256:e7fd305f93057cd205a29999b840210db70789e4cf277625f148447ad7de62b1"},
|
||||||
{url = "https://files.pythonhosted.org/packages/5e/91/7306a912b237e2ea9b347ecd8dc6d0121165b3792eb3d3437aad0e64baf9/djlint-1.19.6.tar.gz", hash = "sha256:a28133317eccc3924b157c947f98f0bdc300f754f51097b5467c73e112aa9fec"},
|
{url = "https://files.pythonhosted.org/packages/5e/91/7306a912b237e2ea9b347ecd8dc6d0121165b3792eb3d3437aad0e64baf9/djlint-1.19.6.tar.gz", hash = "sha256:a28133317eccc3924b157c947f98f0bdc300f754f51097b5467c73e112aa9fec"},
|
||||||
|
@ -49,7 +49,10 @@ indent_size = 2
|
|||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
plugins = ["mypy_django_plugin.main"]
|
plugins = [
|
||||||
|
"mypy_django_plugin.main",
|
||||||
|
"mypy_drf_plugin.main",
|
||||||
|
]
|
||||||
|
|
||||||
[tool.django-stubs]
|
[tool.django-stubs]
|
||||||
django_settings_module = "cmsmanage.settings.dev"
|
django_settings_module = "cmsmanage.settings.dev"
|
||||||
@ -72,6 +75,7 @@ typing = [
|
|||||||
"types-bleach>=5.0.3.1",
|
"types-bleach>=5.0.3.1",
|
||||||
"types-requests>=2.28.11.5",
|
"types-requests>=2.28.11.5",
|
||||||
"types-urllib3>=1.26.25.4",
|
"types-urllib3>=1.26.25.4",
|
||||||
|
"djangorestframework-stubs[compatible-mypy]>=1.8.0",
|
||||||
]
|
]
|
||||||
debug = [
|
debug = [
|
||||||
"django-debug-toolbar~=3.2",
|
"django-debug-toolbar~=3.2",
|
||||||
|
Loading…
Reference in New Issue
Block a user