Skip to content

Conversation

@filwaitman
Copy link

@@ -1 +1,2 @@
__version__ = '1.1.3'
Copy link
Owner

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'
Copy link
Owner

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 -*-
Copy link
Owner

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):
Copy link
Owner

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.

@elky
Copy link
Owner

elky commented Apr 15, 2019

@filwaitman thank you for your PR. Thing you're suggesting is really useful.

One only thing - we shouldn't use ImproperlyConfigured because some people use their own fork of flat app. This exception will break their project.

Let's use Warning message instead:

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 self to check_installed_apps in apps.py

Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Suggestion]: Fail loudly when trying to install on Django>=1.9

2 participants