Ensure INSTALLED_APPS sanity for flat app according to Django version#37
Open
filwaitman wants to merge 1 commit intoelky:masterfrom
filwaitman:feature/ensure-installed-apps-sanity
Open
Ensure INSTALLED_APPS sanity for flat app according to Django version#37filwaitman wants to merge 1 commit intoelky:masterfrom filwaitman:feature/ensure-installed-apps-sanity
filwaitman wants to merge 1 commit intoelky:masterfrom
filwaitman:feature/ensure-installed-apps-sanity
Conversation
elky
reviewed
Apr 15, 2019
| @@ -1 +1,2 @@ | |||
| __version__ = '1.1.3' | |||
elky
reviewed
Apr 15, 2019
|
|
||
| class FlatConfig(AppConfig): | ||
| name = 'flat' | ||
| verbose_name = 'Django flat theme' |
elky
reviewed
Apr 15, 2019
| @@ -0,0 +1,13 @@ | |||
| # -*- coding: utf-8 -*- | |||
Owner
There was a problem hiding this comment.
I don't think we need it here since there's no non-ascii characters in code
elky
reviewed
Apr 15, 2019
| dj_version = django.VERSION | ||
| installed_apps = settings.INSTALLED_APPS | ||
|
|
||
| if dj_version < (1, 9): |
Owner
There was a problem hiding this comment.
I don't see real use case for this. Obviously if someone installed 'flat' by pip and doesn't use it - we shouldn't warn user.
Let's use only if dj_version > (1, 9): case.
Owner
|
@filwaitman thank you for your PR. Thing you're suggesting is really useful. One only thing - we shouldn't use Let's use import django
from django.conf import settings
from django.core.checks import Warning, register
@register()
def check_installed_apps(app_configs, **kwargs):
warnings = []
if django.VERSION[:2] >= (1, 9) and 'flat' in settings.INSTALLED_APPS:
warnings.append(Warning(
"'flat' app is included as part of Django from version 1.9.",
hint='Please remove it from INSTALLED_APPS.',
id='flat.W001',
))
return warningsthen make sure you pass Many thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #36
This solution is similar to https://github.com/fabiocaccamo/django-admin-interface/blob/master/admin_interface/settings.py