Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Use decorator instead of django settings #1

Open
efagerberg opened this issue Apr 10, 2018 · 0 comments
Open

Use decorator instead of django settings #1

efagerberg opened this issue Apr 10, 2018 · 0 comments

Comments

@efagerberg
Copy link
Contributor

efagerberg commented Apr 10, 2018

Instead of doing

DATABASE_ROUTERS = ['django_model_deprecater.routers.DeprecatedModelRouter']
DEPRECATED_MODEL_ROUTER = {
    # Whether to allow migrate if model deprecated
    'check_allow_migrate': False,
    # Whether to allow relations if a model in the auth app is involved
    'check_allow_relation': False,
    'models': {},
}

It might be better to handle the model collection via a decorator, then once collected those models can be handed to the router.

To preserve the per environment capability of using settings, there should be some environment to warning or exception mapping.

Using a decorator might also serve as an entrypoint to detect pure python usages of the model and raise the warning or error as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant