# HG changeset patch # User ymh # Date 1424943237 -3600 # Node ID 87555646dd071a6f7d4c0ad1a3828e6284af2340 # Parent 13e207b05501ba72b01e4d345104824f6ab478b4 correct renkan migration, remove dependency to hdabo diff -r 13e207b05501 -r 87555646dd07 .hgignore --- a/.hgignore Thu Feb 19 13:06:46 2015 +0100 +++ b/.hgignore Thu Feb 26 10:33:57 2015 +0100 @@ -25,3 +25,4 @@ ^server/python/django/renkanmanager\.egg-info$ ^client/bower_components ^client/lib +^server/python/django/MANIFEST\.in$ diff -r 13e207b05501 -r 87555646dd07 server/python/django/renkanmanager/migrations/0001_initial.py --- a/server/python/django/renkanmanager/migrations/0001_initial.py Thu Feb 19 13:06:46 2015 +0100 +++ b/server/python/django/renkanmanager/migrations/0001_initial.py Thu Feb 26 10:33:57 2015 +0100 @@ -1,8 +1,16 @@ # -*- coding: utf-8 -*- -from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration -from django.db import models + +try: + from django.contrib.auth import get_user_model +except ImportError: + from django.contrib.auth.models import User +else: + User = get_user_model() + +user_orm_label = '%s.%s' % (User._meta.app_label, User._meta.object_name) +user_model_label = '%s.%s' % (User._meta.app_label, User._meta.module_name) class Migration(SchemaMigration): @@ -11,7 +19,7 @@ # Adding model 'Renkan' db.create_table(u'renkanmanager_renkan', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('owner', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['hdabo.User'], null=True, blank=True)), + ('owner', self.gf('django.db.models.fields.related.ForeignKey')(to=orm[user_orm_label], null=True, blank=True)), ('rk_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=1024)), ('content', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), ('title', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True)), @@ -48,21 +56,16 @@ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) }, - u'hdabo.user': { - 'Meta': {'object_name': 'User', 'db_table': "'auth_user'"}, - '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'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + user_model_label: { + 'Meta': { + 'object_name': User.__name__, + 'db_table': "'%s'" % User._meta.db_table + }, + User._meta.pk.attname: ( + 'django.db.models.fields.AutoField', [], + {'primary_key': 'True', + 'db_column': "'%s'" % User._meta.pk.column} + ), }, 'renkanmanager.renkan': { 'Meta': {'object_name': 'Renkan'}, @@ -71,7 +74,7 @@ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'image': ('django.db.models.fields.files.ImageField', [], {'default': "'thumbnails/renkan/renkan_default_icon.png'", 'max_length': '100'}), 'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['hdabo.User']", 'null': 'True', 'blank': 'True'}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['%s']" % user_orm_label, 'null': 'True', 'blank': 'True'}), 'rk_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '1024'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}) } diff -r 13e207b05501 -r 87555646dd07 server/python/django/renkanmanager/models.py --- a/server/python/django/renkanmanager/models.py Thu Feb 19 13:06:46 2015 +0100 +++ b/server/python/django/renkanmanager/models.py Thu Feb 26 10:33:57 2015 +0100 @@ -5,13 +5,13 @@ ''' from django.conf import settings from django.db import models -from hdabo.models import User from easy_thumbnails.fields import ThumbnailerImageField +auth_user_model = getattr(settings, 'AUTH_USER_MODEL', 'auth.User') class Renkan(models.Model): - owner = models.ForeignKey(User, blank=True, null=True) + owner = models.ForeignKey(auth_user_model, blank=True, null=True) rk_id = models.CharField(max_length=1024, unique=True, blank=False, null=False) # typically UUID content = models.TextField(blank=True, null=True) title = models.CharField(max_length=1024, null=True)