-
Notifications
You must be signed in to change notification settings - Fork 45
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
Ensure INSTALLED_APPS sanity for flat app according to Django version #37
base: master
Are you sure you want to change the base?
Ensure INSTALLED_APPS sanity for flat app according to Django version #37
Conversation
@@ -1 +1,2 @@ | |||
__version__ = '1.1.3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update version up to 1.2.0
|
||
class FlatConfig(AppConfig): | ||
name = 'flat' | ||
verbose_name = 'Django flat theme' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Title Case here
@@ -0,0 +1,13 @@ | |||
# -*- coding: utf-8 -*- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need it here since there's no non-ascii characters in code
dj_version = django.VERSION | ||
installed_apps = settings.INSTALLED_APPS | ||
|
||
if dj_version < (1, 9): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@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 warnings then make sure you pass Many thanks! |
Closes #36
This solution is similar to https://github.com/fabiocaccamo/django-admin-interface/blob/master/admin_interface/settings.py