summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshtimn@gmail.com <shtimn@gmail.com>2014-08-11 16:54:27 (GMT)
committershtimn@gmail.com <shtimn@gmail.com>2014-08-11 16:54:27 (GMT)
commit6acfddc50782511b5a44c00d6a67f891e085058c (patch)
treeb4ba0909374b635cae7f6649b11dad20ea237f8d
parent6002ecb9e3c2ae22239f1be337d1d29fb79a7e8d (diff)
downloaddjango-admin-tools-6acfddc50782511b5a44c00d6a67f891e085058c.zip
django-admin-tools-6acfddc50782511b5a44c00d6a67f891e085058c.tar.gz
django-admin-tools-6acfddc50782511b5a44c00d6a67f891e085058c.tar.bz2
Backwards compatible for django < 1.5.
--HG-- branch : fix_migrations_for_custom_user_model
-rw-r--r--admin_tools/dashboard/migrations/0001_initial.py14
-rw-r--r--admin_tools/menu/migrations/0001_initial.py10
2 files changed, 18 insertions, 6 deletions
diff --git a/admin_tools/dashboard/migrations/0001_initial.py b/admin_tools/dashboard/migrations/0001_initial.py
index 21ed269..5c128f2 100644
--- a/admin_tools/dashboard/migrations/0001_initial.py
+++ b/admin_tools/dashboard/migrations/0001_initial.py
@@ -4,16 +4,22 @@ from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.conf import settings
-from django.contrib.auth import get_user_model
from south import modelsinspector
+try:
+ from django.contrib.auth import get_user_model
+ UserModel = get_user_model()
+except ImportError:
+ from django.contrib.auth.models import User as UserModel
+
+
user_model = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
class Migration(SchemaMigration):
def forwards(self, orm):
-
+
# Adding model 'DashboardPreferences'
db.create_table('admin_tools_dashboard_preferences', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
@@ -24,7 +30,7 @@ class Migration(SchemaMigration):
def backwards(self, orm):
-
+
# Deleting model 'DashboardPreferences'
db.delete_table('admin_tools_dashboard_preferences')
@@ -44,7 +50,7 @@ class Migration(SchemaMigration):
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
user_model: {
- 'Meta': modelsinspector.get_model_meta(get_user_model()),
+ 'Meta': modelsinspector.get_model_meta(UserModel),
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
diff --git a/admin_tools/menu/migrations/0001_initial.py b/admin_tools/menu/migrations/0001_initial.py
index dd96bee..e197160 100644
--- a/admin_tools/menu/migrations/0001_initial.py
+++ b/admin_tools/menu/migrations/0001_initial.py
@@ -5,7 +5,13 @@ from south.v2 import SchemaMigration
from django.db import models
from django.conf import settings
from south import modelsinspector
-from django.contrib.auth import get_user_model
+
+try:
+ from django.contrib.auth import get_user_model
+ UserModel = get_user_model()
+except ImportError:
+ from django.contrib.auth.models import User as UserModel
+
user_model = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
@@ -43,7 +49,7 @@ class Migration(SchemaMigration):
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
user_model: {
- 'Meta': modelsinspector.get_model_meta(get_user_model()),
+ 'Meta': modelsinspector.get_model_meta(UserModel),
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),