-
Notifications
You must be signed in to change notification settings - Fork 45
Ensure INSTALLED_APPS sanity for flat app according to Django version #37
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| __version__ = '1.1.3' | ||
| default_app_config = 'flat.apps.FlatConfig' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class FlatConfig(AppConfig): | ||
| name = 'flat' | ||
| verbose_name = 'Django flat theme' | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use Title Case here |
||
|
|
||
| def ready(self): | ||
| from flat import settings | ||
|
|
||
| settings.check_installed_apps() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| import django | ||
| from django.conf import settings | ||
| from django.core.exceptions import ImproperlyConfigured | ||
|
|
||
|
|
||
| def check_installed_apps(): | ||
| dj_version = django.VERSION | ||
| installed_apps = settings.INSTALLED_APPS | ||
|
|
||
| if dj_version < (1, 9): | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 'flat' not in installed_apps: | ||
| raise ImproperlyConfigured( | ||
| '\'flat\' needed before django 1.9, ' | ||
| 'add it to settings.INSTALLED_APPS.') | ||
| else: | ||
| if 'flat' in installed_apps: | ||
| raise ImproperlyConfigured( | ||
| '\'flat\' not needed since django 1.9, ' | ||
| 'remove it from settings.INSTALLED_APPS.') | ||
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