Skip to content

Instantly share code, notes, and snippets.

@Kniyl
Last active August 29, 2015 14:18
Show Gist options
  • Save Kniyl/8b7822cfa25eb20458cf to your computer and use it in GitHub Desktop.
Save Kniyl/8b7822cfa25eb20458cf to your computer and use it in GitHub Desktop.
Version checker for django 1.8 / modeltranslation 0.8.1
diff --git a/mezzanine/utils/conf.py b/mezzanine/utils/conf.py
index 1f9c321..5d8bef2 100644
--- a/mezzanine/utils/conf.py
+++ b/mezzanine/utils/conf.py
@@ -110,9 +110,15 @@ def set_dynamic_settings(s):
warn("USE_MODETRANSLATION setting is set to True but django-"
"modeltranslation is not installed. Disabling it.")
else:
- # Force i18n so we are assured that modeltranslation is active
- s["USE_I18N"] = True
- append("INSTALLED_APPS", "modeltranslation")
+ import django.VERSION as dVERSION
+ import modeltranslation.VERSION as mVERSION
+ if dVERSION > (1,8) and mVERSION < (0,8,2):
+ # Modeltranslation 0.8.1 is not compatible with django 1.8
+ remove("INSTALLED_APPS", "modeltranslation")
+ else:
+ # Force i18n so we are assured that modeltranslation is active
+ s["USE_I18N"] = True
+ append("INSTALLED_APPS", "modeltranslation")
# Setup for optional apps.
optional = list(s.get("OPTIONAL_APPS", []))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment