summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Jean Louis <izimobil@gmail.com>2014-08-11 17:02:57 (GMT)
committerDavid Jean Louis <izimobil@gmail.com>2014-08-11 17:02:57 (GMT)
commit290520d1b76518764aa0ec21070df703a6d0e40e (patch)
treeefd8125f6fd0a7fe49f28eaa3c7a6afb85b81955
parent936a934295f925ed5b98d2d32328d18f4f198665 (diff)
parent6acfddc50782511b5a44c00d6a67f891e085058c (diff)
downloaddjango-admin-tools-290520d1b76518764aa0ec21070df703a6d0e40e.zip
django-admin-tools-290520d1b76518764aa0ec21070df703a6d0e40e.tar.gz
django-admin-tools-290520d1b76518764aa0ec21070df703a6d0e40e.tar.bz2
Merged in shtimn/django-admin-tools/fix_migrations_for_custom_user_model (pull request #33)
Fixed initial migrations for custom user models which override db_table.
-rw-r--r--admin_tools/dashboard/migrations/0001_initial.py14
-rw-r--r--admin_tools/menu/migrations/0001_initial.py10
2 files changed, 20 insertions, 4 deletions
diff --git a/admin_tools/dashboard/migrations/0001_initial.py b/admin_tools/dashboard/migrations/0001_initial.py
index bfb233a..5c128f2 100644
--- a/admin_tools/dashboard/migrations/0001_initial.py
+++ b/admin_tools/dashboard/migrations/0001_initial.py
@@ -4,6 +4,14 @@ from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.conf import settings
+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')
@@ -11,7 +19,7 @@ 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)),
@@ -22,7 +30,7 @@ class Migration(SchemaMigration):
def backwards(self, orm):
-
+
# Deleting model 'DashboardPreferences'
db.delete_table('admin_tools_dashboard_preferences')
@@ -42,7 +50,7 @@ class Migration(SchemaMigration):
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
user_model: {
- 'Meta': {'object_name': user_model.split('.')[1]},
+ '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 d4b3a2d..e197160 100644
--- a/admin_tools/menu/migrations/0001_initial.py
+++ b/admin_tools/menu/migrations/0001_initial.py
@@ -4,6 +4,14 @@ from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.conf import settings
+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')
@@ -41,7 +49,7 @@ class Migration(SchemaMigration):
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
user_model: {
- 'Meta': {'object_name': user_model.split('.')[1]},
+ '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'}),