aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/authtoken
diff options
context:
space:
mode:
authorJonas Liljestrand2012-11-19 11:37:37 +0100
committerJonas Liljestrand2012-11-19 11:37:37 +0100
commit0bcc840927ab08d0e7d64844f3242036a142113d (patch)
treeddc5121c86f70f34046c6a7fdce9b8f87c87c0b2 /rest_framework/authtoken
parent91c0249c9d622670252030cb36ea872c08d91471 (diff)
downloaddjango-rest-framework-0bcc840927ab08d0e7d64844f3242036a142113d.tar.bz2
Complete fix for migration
Diffstat (limited to 'rest_framework/authtoken')
-rw-r--r--rest_framework/authtoken/migrations/0001_initial.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/rest_framework/authtoken/migrations/0001_initial.py b/rest_framework/authtoken/migrations/0001_initial.py
index 2c0c40b1..f4e052e4 100644
--- a/rest_framework/authtoken/migrations/0001_initial.py
+++ b/rest_framework/authtoken/migrations/0001_initial.py
@@ -3,7 +3,14 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
-from rest_framework.compat import User
+
+
+try:
+ from django.contrib.auth import get_user_model
+except ImportError: # django < 1.5
+ from django.contrib.auth.models import User
+else:
+ User = get_user_model()
class Migration(SchemaMigration):
@@ -12,7 +19,7 @@ class Migration(SchemaMigration):
# Adding model 'Token'
db.create_table('authtoken_token', (
('key', self.gf('django.db.models.fields.CharField')(max_length=40, primary_key=True)),
- ('user', self.gf('django.db.models.fields.related.OneToOneField')(related_name='auth_token', unique=True, to=orm["%s.%s" % (User._meta.app_label, User._meta.object_name)])),
+ ('user', self.gf('django.db.models.fields.related.OneToOneField')(related_name='auth_token', unique=True, to=orm['%s.%s' % (User._meta.app_label, User._meta.object_name)])),
('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
))
db.send_create_signal('authtoken', ['Token'])
@@ -37,7 +44,7 @@ class Migration(SchemaMigration):
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
- 'auth.user': {
+ "%s.%s" % (User._meta.app_label, User._meta.module_name): {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
@@ -57,7 +64,7 @@ class Migration(SchemaMigration):
'Meta': {'object_name': 'Token'},
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'primary_key': 'True'}),
- 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'auth_token'", 'unique': 'True', 'to': "orm['auth.User']"})
+ 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'auth_token'", 'unique': 'True', 'to': "orm['%s.%s']" % (User._meta.app_label, User._meta.object_name)})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},