Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add potential deprecation warning for email_relay.db.EmailDatabaseRouter #156

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/email_relay/checks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from __future__ import annotations

from django.conf import settings
from django.core.checks import Tags
from django.core.checks import Warning
from django.core.checks import register

from email_relay.db import EmailDatabaseRouter


@register(Tags.compatibility)
def check_for_deprecated_db_router(app_configs, **kwargs):
if (
"email_relay" in settings.INSTALLED_APPS
and "email_relay.db.EmailDatabaseRouter" in settings.DATABASE_ROUTERS
):
return [
Warning(
"The email_relay.db.EmailDatabaseRouter will potentially be deprecated in a future version.",
hint="Please visit https://github.com/westerveltco/django-email-relay/issues/154 for more information.",
obj=EmailDatabaseRouter,
id="email_relay.W001",
)
]
return []