From: Radek Czajka Date: Thu, 28 Feb 2019 01:09:12 +0000 (+0100) Subject: Django 1.11; removed unused comments app. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/56145861cf5fa01c5fbb429d40242e0a16189ed1 Django 1.11; removed unused comments app. --- diff --git a/requirements.txt b/requirements.txt index 03c1bc48..2781a336 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,13 +10,13 @@ httplib2 # oauth2 dependency librarian ## Django -Django>=1.6,<1.7 -fnpdjango>=0.2,<0.3 -django-pipeline>=1.4.7,<1.5 +Django==1.11.20 +fnpdjango==0.3 +django-pipeline==1.6.14 django_cas>=2.1,<2.2 sorl-thumbnail>=12.2,<12.4 # ?? django-maintenancemode>=0.9 -django-pagination +fnp-django-pagination==2.2.2 django-gravatar2 python-slugify django-extensions==1.5.7 @@ -24,7 +24,4 @@ django-extensions==1.5.7 celery>=3.1.12,<3.2 kombu>=3.0,<3.1 -# migrations -South>=1.0.2 - raven diff --git a/src/apiclient/migrations/0001_initial.py b/src/apiclient/migrations/0001_initial.py index 4af28a52..43f2d78f 100644 --- a/src/apiclient/migrations/0001_initial.py +++ b/src/apiclient/migrations/0001_initial.py @@ -1,75 +1,29 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models +# -*- coding: utf-8 -*- +from __future__ import unicode_literals -class Migration(SchemaMigration): +from django.db import models, migrations +from django.conf import settings - def forwards(self, orm): - - # Adding model 'OAuthConnection' - db.create_table('apiclient_oauthconnection', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('user', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['auth.User'], unique=True)), - ('access', self.gf('django.db.models.fields.BooleanField')(default=False)), - ('token', self.gf('django.db.models.fields.CharField')(max_length=64, null=True, blank=True)), - ('token_secret', self.gf('django.db.models.fields.CharField')(max_length=64, null=True, blank=True)), - )) - db.send_create_signal('apiclient', ['OAuthConnection']) +class Migration(migrations.Migration): - def backwards(self, orm): - - # Deleting model 'OAuthConnection' - db.delete_table('apiclient_oauthconnection') + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] - - models = { - 'apiclient.oauthconnection': { - 'Meta': {'object_name': 'OAuthConnection'}, - 'access': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'token': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}), - 'token_secret': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'}) - }, - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - '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'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['apiclient'] + operations = [ + migrations.CreateModel( + name='OAuthConnection', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('access', models.BooleanField(default=False)), + ('token', models.CharField(max_length=64, null=True, blank=True)), + ('token_secret', models.CharField(max_length=64, null=True, blank=True)), + ('beta', models.BooleanField(default=False)), + ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ], + options={ + }, + bases=(models.Model,), + ), + ] diff --git a/src/apiclient/migrations/0002_auto__add_field_oauthconnection_beta.py b/src/apiclient/migrations/0002_auto__add_field_oauthconnection_beta.py deleted file mode 100644 index 094606fe..00000000 --- a/src/apiclient/migrations/0002_auto__add_field_oauthconnection_beta.py +++ /dev/null @@ -1,70 +0,0 @@ -# -*- 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 - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'OAuthConnection.beta' - db.add_column(u'apiclient_oauthconnection', 'beta', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'OAuthConnection.beta' - db.delete_column(u'apiclient_oauthconnection', 'beta') - - - models = { - u'apiclient.oauthconnection': { - 'Meta': {'object_name': 'OAuthConnection'}, - 'access': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'beta': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'token': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}), - 'token_secret': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['auth.User']", 'unique': 'True'}) - }, - u'auth.group': { - 'Meta': {'object_name': 'Group'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - u'auth.permission': { - 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - u'auth.user': { - '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'}), - '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'}) - }, - u'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['apiclient'] \ No newline at end of file diff --git a/src/apiclient/migrations/0003_auto__chg_field_oauthconnection_user__del_unique_oauthconnection_user.py b/src/apiclient/migrations/0003_auto__chg_field_oauthconnection_user__del_unique_oauthconnection_user.py deleted file mode 100644 index ebd0fbb4..00000000 --- a/src/apiclient/migrations/0003_auto__chg_field_oauthconnection_user__del_unique_oauthconnection_user.py +++ /dev/null @@ -1,74 +0,0 @@ -# -*- 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 - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Removing unique constraint on 'OAuthConnection', fields ['user'] - db.delete_unique(u'apiclient_oauthconnection', ['user_id']) - - - # Changing field 'OAuthConnection.user' - db.alter_column(u'apiclient_oauthconnection', 'user_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])) - - def backwards(self, orm): - - # Changing field 'OAuthConnection.user' - db.alter_column(u'apiclient_oauthconnection', 'user_id', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['auth.User'], unique=True)) - # Adding unique constraint on 'OAuthConnection', fields ['user'] - db.create_unique(u'apiclient_oauthconnection', ['user_id']) - - - models = { - u'apiclient.oauthconnection': { - 'Meta': {'object_name': 'OAuthConnection'}, - 'access': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'beta': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'token': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}), - 'token_secret': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}) - }, - u'auth.group': { - 'Meta': {'object_name': 'Group'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - u'auth.permission': { - 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - u'auth.user': { - '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'}), - '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'}) - }, - u'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['apiclient'] \ No newline at end of file diff --git a/src/apiclient/urls.py b/src/apiclient/urls.py index f623474e..68cd1618 100755 --- a/src/apiclient/urls.py +++ b/src/apiclient/urls.py @@ -1,9 +1,11 @@ # -*- coding: utf-8 -*- -from django.conf.urls import patterns, url +from django.conf.urls import url +from . import views -urlpatterns = patterns('apiclient.views', - url(r'^oauth/$', 'oauth', name='apiclient_oauth'), - url(r'^oauth_callback/$', 'oauth_callback', name='apiclient_oauth_callback'), - url(r'^oauth-beta/$', 'oauth', kwargs={'beta': True}, name='apiclient_beta_oauth'), - url(r'^oauth_callback-beta/$', 'oauth_callback', kwargs={'beta': True}, name='apiclient_beta_callback'), -) + +urlpatterns = [ + url(r'^oauth/$', views.oauth, name='apiclient_oauth'), + url(r'^oauth_callback/$', views.oauth_callback, name='apiclient_oauth_callback'), + url(r'^oauth-beta/$', views.oauth, kwargs={'beta': True}, name='apiclient_beta_oauth'), + url(r'^oauth_callback-beta/$', views.oauth_callback, kwargs={'beta': True}, name='apiclient_beta_callback'), +] diff --git a/src/catalogue/management/__init__.py b/src/catalogue/management/__init__.py index bc3d6c02..e537f9e5 100644 --- a/src/catalogue/management/__init__.py +++ b/src/catalogue/management/__init__.py @@ -100,19 +100,15 @@ class XmlUpdater(object): books = Book.objects.all() # Start transaction management. - transaction.enter_transaction_management() - - for book in books: - self.counters['All books'] += 1 - chunks = book.chunk_set.all() - if self.only_first_chunk: - chunks = chunks[:1] - for chunk in chunks: - self.counters['All chunks'] += 1 - self.fix_chunk(chunk, user, verbose, dry_run) - - transaction.commit() - transaction.leave_transaction_management() + with transaction.atomic(): + for book in books: + self.counters['All books'] += 1 + chunks = book.chunk_set.all() + if self.only_first_chunk: + chunks = chunks[:1] + for chunk in chunks: + self.counters['All chunks'] += 1 + self.fix_chunk(chunk, user, verbose, dry_run) def print_results(self): """Prints the counters.""" diff --git a/src/catalogue/migrations/0001_initial.py b/src/catalogue/migrations/0001_initial.py index dccd9b7b..2dd2336d 100644 --- a/src/catalogue/migrations/0001_initial.py +++ b/src/catalogue/migrations/0001_initial.py @@ -1,240 +1,329 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding model 'Book' - db.create_table('catalogue_book', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('title', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)), - ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=128, db_index=True)), - ('gallery', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)), - ('parent', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='children', null=True, to=orm['catalogue.Book'])), - ('parent_number', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)), - ('_short_html', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), - ('_single', self.gf('django.db.models.fields.NullBooleanField')(db_index=True, null=True, blank=True)), - ('_new_publishable', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), - ('_published', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), - )) - db.send_create_signal('catalogue', ['Book']) - - # Adding model 'Chunk' - db.create_table('catalogue_chunk', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('creator', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='created_documents', null=True, to=orm['auth.User'])), - ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)), - ('book', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.Book'])), - ('number', self.gf('django.db.models.fields.IntegerField')()), - ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)), - ('title', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)), - ('_short_html', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), - ('_hidden', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), - ('_changed', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), - ('stage', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.ChunkTag'], null=True, blank=True)), - ('head', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['catalogue.ChunkChange'], null=True, blank=True)), - )) - db.send_create_signal('catalogue', ['Chunk']) - - # Adding unique constraint on 'Chunk', fields ['book', 'number'] - db.create_unique('catalogue_chunk', ['book_id', 'number']) - - # Adding unique constraint on 'Chunk', fields ['book', 'slug'] - db.create_unique('catalogue_chunk', ['book_id', 'slug']) - - # Adding model 'ChunkTag' - db.create_table('catalogue_chunktag', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=64)), - ('slug', self.gf('django.db.models.fields.SlugField')(db_index=True, max_length=64, unique=True, null=True, blank=True)), - ('ordering', self.gf('django.db.models.fields.IntegerField')()), - )) - db.send_create_signal('catalogue', ['ChunkTag']) - - # Adding model 'ChunkChange' - db.create_table('catalogue_chunkchange', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)), - ('author_name', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)), - ('author_email', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)), - ('revision', self.gf('django.db.models.fields.IntegerField')(db_index=True)), - ('parent', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='children', null=True, blank=True, to=orm['catalogue.ChunkChange'])), - ('merge_parent', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='merge_children', null=True, blank=True, to=orm['catalogue.ChunkChange'])), - ('description', self.gf('django.db.models.fields.TextField')(default='', blank=True)), - ('created_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, db_index=True)), - ('publishable', self.gf('django.db.models.fields.BooleanField')(default=False)), - ('tree', self.gf('django.db.models.fields.related.ForeignKey')(related_name='change_set', to=orm['catalogue.Chunk'])), - ('data', self.gf('django.db.models.fields.files.FileField')(max_length=100)), - )) - db.send_create_signal('catalogue', ['ChunkChange']) - - # Adding unique constraint on 'ChunkChange', fields ['tree', 'revision'] - db.create_unique('catalogue_chunkchange', ['tree_id', 'revision']) - - # Adding M2M table for field tags on 'ChunkChange' - db.create_table('catalogue_chunkchange_tags', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('chunkchange', models.ForeignKey(orm['catalogue.chunkchange'], null=False)), - ('chunktag', models.ForeignKey(orm['catalogue.chunktag'], null=False)) - )) - db.create_unique('catalogue_chunkchange_tags', ['chunkchange_id', 'chunktag_id']) - - # Adding model 'BookPublishRecord' - db.create_table('catalogue_bookpublishrecord', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('book', self.gf('django.db.models.fields.related.ForeignKey')(related_name='publish_log', to=orm['catalogue.Book'])), - ('timestamp', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), - )) - db.send_create_signal('catalogue', ['BookPublishRecord']) +# -*- coding: utf-8 -*- +from __future__ import unicode_literals - # Adding model 'ChunkPublishRecord' - db.create_table('catalogue_chunkpublishrecord', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('book_record', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.BookPublishRecord'])), - ('change', self.gf('django.db.models.fields.related.ForeignKey')(related_name='publish_log', to=orm['catalogue.ChunkChange'])), - )) - db.send_create_signal('catalogue', ['ChunkPublishRecord']) - - - def backwards(self, orm): - - # Removing unique constraint on 'ChunkChange', fields ['tree', 'revision'] - db.delete_unique('catalogue_chunkchange', ['tree_id', 'revision']) - - # Removing unique constraint on 'Chunk', fields ['book', 'slug'] - db.delete_unique('catalogue_chunk', ['book_id', 'slug']) - - # Removing unique constraint on 'Chunk', fields ['book', 'number'] - db.delete_unique('catalogue_chunk', ['book_id', 'number']) - - # Deleting model 'Book' - db.delete_table('catalogue_book') - - # Deleting model 'Chunk' - db.delete_table('catalogue_chunk') - - # Deleting model 'ChunkTag' - db.delete_table('catalogue_chunktag') - - # Deleting model 'ChunkChange' - db.delete_table('catalogue_chunkchange') - - # Removing M2M table for field tags on 'ChunkChange' - db.delete_table('catalogue_chunkchange_tags') - - # Deleting model 'BookPublishRecord' - db.delete_table('catalogue_bookpublishrecord') +from django.db import models, migrations +import datetime +import django.db.models.deletion +from django.conf import settings +import dvcs.models +import dvcs.storage - # Deleting model 'ChunkPublishRecord' - db.delete_table('catalogue_chunkpublishrecord') +class Migration(migrations.Migration): - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - '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'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['parent_number', 'title']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) - }, - 'catalogue.bookpublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'}, - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) - }, - 'catalogue.chunk': { - 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_documents'", 'null': 'True', 'to': "orm['auth.User']"}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.chunkchange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"}) - }, - 'catalogue.chunkpublishrecord': { - 'Meta': {'object_name': 'ChunkPublishRecord'}, - 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}), - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } + dependencies = [ + ('auth', '0001_initial'), + ('cover', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] - complete_apps = ['catalogue'] + operations = [ + migrations.CreateModel( + name='Book', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('title', models.CharField(max_length=255, verbose_name='title', db_index=True)), + ('slug', models.SlugField(unique=True, max_length=128, verbose_name='slug')), + ('public', models.BooleanField(default=True, db_index=True, verbose_name='public')), + ('gallery', models.CharField(max_length=255, verbose_name='scan gallery name', blank=True)), + ('parent_number', models.IntegerField(db_index=True, verbose_name='parent number', null=True, editable=False, blank=True)), + ('_short_html', models.TextField(null=True, editable=False, blank=True)), + ('_single', models.NullBooleanField(db_index=True, editable=False)), + ('_new_publishable', models.NullBooleanField(editable=False)), + ('_published', models.NullBooleanField(editable=False)), + ('_on_track', models.IntegerField(db_index=True, null=True, editable=False, blank=True)), + ('dc_slug', models.CharField(db_index=True, max_length=128, null=True, editable=False, blank=True)), + ], + options={ + 'ordering': ['title', 'slug'], + 'verbose_name': 'book', + 'verbose_name_plural': 'books', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='BookPublishRecord', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('timestamp', models.DateTimeField(auto_now_add=True, verbose_name='time')), + ('book', models.ForeignKey(related_name='publish_log', verbose_name='book', to='catalogue.Book')), + ('user', models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ['-timestamp'], + 'verbose_name': 'book publish record', + 'verbose_name_plural': 'book publish records', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Chunk', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('number', models.IntegerField(verbose_name='number')), + ('title', models.CharField(max_length=255, verbose_name='title', blank=True)), + ('slug', models.SlugField(verbose_name='slug')), + ('gallery_start', models.IntegerField(default=1, null=True, verbose_name='gallery start', blank=True)), + ('_short_html', models.TextField(null=True, editable=False, blank=True)), + ('_hidden', models.NullBooleanField(editable=False)), + ('_changed', models.NullBooleanField(editable=False)), + ('book', models.ForeignKey(editable=False, to='catalogue.Book', verbose_name='book')), + ('creator', models.ForeignKey(related_name='created_chunk', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='creator')), + ], + options={ + 'ordering': ['number'], + 'verbose_name': 'chunk', + 'verbose_name_plural': 'chunks', + 'permissions': [('can_pubmark', 'Can mark for publishing')], + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='ChunkChange', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('author_name', models.CharField(help_text='Used if author is not set.', max_length=128, null=True, verbose_name='author name', blank=True)), + ('author_email', models.CharField(help_text='Used if author is not set.', max_length=128, null=True, verbose_name='author email', blank=True)), + ('revision', models.IntegerField(verbose_name='revision', db_index=True)), + ('description', models.TextField(default=b'', verbose_name='description', blank=True)), + ('created_at', models.DateTimeField(default=datetime.datetime.now, editable=False, db_index=True)), + ('publishable', models.BooleanField(default=False, verbose_name='publishable')), + ('data', models.FileField(upload_to=dvcs.models.data_upload_to, storage=dvcs.storage.GzipFileSystemStorage(location=settings.CATALOGUE_REPO_PATH), verbose_name='data')), + ('author', models.ForeignKey(verbose_name='author', blank=True, to=settings.AUTH_USER_MODEL, null=True)), + ('merge_parent', models.ForeignKey(related_name='merge_children', default=None, blank=True, to='catalogue.ChunkChange', null=True, verbose_name='merge parent')), + ('parent', models.ForeignKey(related_name='children', default=None, blank=True, to='catalogue.ChunkChange', null=True, verbose_name='parent')), + ], + options={ + 'ordering': ('created_at',), + 'abstract': False, + 'verbose_name': 'change for: chunk', + 'verbose_name_plural': 'changes for: chunk', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='ChunkPublishRecord', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('book_record', models.ForeignKey(verbose_name='book publish record', to='catalogue.BookPublishRecord')), + ('change', models.ForeignKey(related_name='publish_log', verbose_name='change', to='catalogue.ChunkChange')), + ], + options={ + 'verbose_name': 'chunk publish record', + 'verbose_name_plural': 'chunk publish records', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='ChunkTag', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=64, verbose_name='name')), + ('slug', models.SlugField(null=True, max_length=64, blank=True, unique=True, verbose_name='slug')), + ('ordering', models.IntegerField(verbose_name='ordering')), + ], + options={ + 'ordering': ['ordering'], + 'abstract': False, + 'verbose_name': 'tag for: chunk', + 'verbose_name_plural': 'tags for: chunk', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Image', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('image', models.FileField(upload_to=b'catalogue/images', verbose_name='image')), + ('title', models.CharField(max_length=255, verbose_name='title', blank=True)), + ('slug', models.SlugField(unique=True, verbose_name='slug')), + ('public', models.BooleanField(default=True, db_index=True, verbose_name='public')), + ('_short_html', models.TextField(null=True, editable=False, blank=True)), + ('_new_publishable', models.NullBooleanField(editable=False)), + ('_published', models.NullBooleanField(editable=False)), + ('_changed', models.NullBooleanField(editable=False)), + ('creator', models.ForeignKey(related_name='created_image', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='creator')), + ], + options={ + 'ordering': ['title'], + 'verbose_name': 'image', + 'verbose_name_plural': 'images', + 'permissions': [('can_pubmark_image', 'Can mark images for publishing')], + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='ImageChange', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('author_name', models.CharField(help_text='Used if author is not set.', max_length=128, null=True, verbose_name='author name', blank=True)), + ('author_email', models.CharField(help_text='Used if author is not set.', max_length=128, null=True, verbose_name='author email', blank=True)), + ('revision', models.IntegerField(verbose_name='revision', db_index=True)), + ('description', models.TextField(default=b'', verbose_name='description', blank=True)), + ('created_at', models.DateTimeField(default=datetime.datetime.now, editable=False, db_index=True)), + ('publishable', models.BooleanField(default=False, verbose_name='publishable')), + ('data', models.FileField(upload_to=dvcs.models.data_upload_to, storage=dvcs.storage.GzipFileSystemStorage(location=settings.CATALOGUE_IMAGE_REPO_PATH), verbose_name='data')), + ('author', models.ForeignKey(verbose_name='author', blank=True, to=settings.AUTH_USER_MODEL, null=True)), + ('merge_parent', models.ForeignKey(related_name='merge_children', default=None, blank=True, to='catalogue.ImageChange', null=True, verbose_name='merge parent')), + ('parent', models.ForeignKey(related_name='children', default=None, blank=True, to='catalogue.ImageChange', null=True, verbose_name='parent')), + ], + options={ + 'ordering': ('created_at',), + 'abstract': False, + 'verbose_name': 'change for: image', + 'verbose_name_plural': 'changes for: image', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='ImagePublishRecord', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('timestamp', models.DateTimeField(auto_now_add=True, verbose_name='time')), + ('change', models.ForeignKey(related_name='publish_log', verbose_name='change', to='catalogue.ImageChange')), + ('image', models.ForeignKey(related_name='publish_log', verbose_name='image', to='catalogue.Image')), + ('user', models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ['-timestamp'], + 'verbose_name': 'image publish record', + 'verbose_name_plural': 'image publish records', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='ImageTag', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=64, verbose_name='name')), + ('slug', models.SlugField(null=True, max_length=64, blank=True, unique=True, verbose_name='slug')), + ('ordering', models.IntegerField(verbose_name='ordering')), + ], + options={ + 'ordering': ['ordering'], + 'abstract': False, + 'verbose_name': 'tag for: image', + 'verbose_name_plural': 'tags for: image', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Project', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(unique=True, max_length=255, verbose_name='name')), + ('notes', models.TextField(null=True, verbose_name='notes', blank=True)), + ], + options={ + 'ordering': ['name'], + 'verbose_name': 'project', + 'verbose_name_plural': 'projects', + }, + bases=(models.Model,), + ), + migrations.AddField( + model_name='imagechange', + name='tags', + field=models.ManyToManyField(related_name='change_set', verbose_name='tags', to='catalogue.ImageTag'), + preserve_default=True, + ), + migrations.AddField( + model_name='imagechange', + name='tree', + field=models.ForeignKey(related_name='change_set', verbose_name='document', to='catalogue.Image'), + preserve_default=True, + ), + migrations.AlterUniqueTogether( + name='imagechange', + unique_together=set([('tree', 'revision')]), + ), + migrations.AddField( + model_name='image', + name='head', + field=models.ForeignKey(default=None, editable=False, to='catalogue.ImageChange', blank=True, help_text="This document's current head.", null=True, verbose_name='head'), + preserve_default=True, + ), + migrations.AddField( + model_name='image', + name='project', + field=models.ForeignKey(blank=True, to='catalogue.Project', null=True), + preserve_default=True, + ), + migrations.AddField( + model_name='image', + name='stage', + field=models.ForeignKey(verbose_name='stage', blank=True, to='catalogue.ImageTag', null=True), + preserve_default=True, + ), + migrations.AddField( + model_name='image', + name='user', + field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, help_text='Work assignment.', null=True, verbose_name='user'), + preserve_default=True, + ), + migrations.AddField( + model_name='chunkchange', + name='tags', + field=models.ManyToManyField(related_name='change_set', verbose_name='tags', to='catalogue.ChunkTag'), + preserve_default=True, + ), + migrations.AddField( + model_name='chunkchange', + name='tree', + field=models.ForeignKey(related_name='change_set', verbose_name='document', to='catalogue.Chunk'), + preserve_default=True, + ), + migrations.AlterUniqueTogether( + name='chunkchange', + unique_together=set([('tree', 'revision')]), + ), + migrations.AddField( + model_name='chunk', + name='head', + field=models.ForeignKey(default=None, editable=False, to='catalogue.ChunkChange', blank=True, help_text="This document's current head.", null=True, verbose_name='head'), + preserve_default=True, + ), + migrations.AddField( + model_name='chunk', + name='stage', + field=models.ForeignKey(verbose_name='stage', blank=True, to='catalogue.ChunkTag', null=True), + preserve_default=True, + ), + migrations.AddField( + model_name='chunk', + name='user', + field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, help_text='Work assignment.', null=True, verbose_name='user'), + preserve_default=True, + ), + migrations.AlterUniqueTogether( + name='chunk', + unique_together=set([('book', 'number'), ('book', 'slug')]), + ), + migrations.AddField( + model_name='book', + name='dc_cover_image', + field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, blank=True, editable=False, to='cover.Image', null=True), + preserve_default=True, + ), + migrations.AddField( + model_name='book', + name='parent', + field=models.ForeignKey(related_name='children', blank=True, editable=False, to='catalogue.Book', null=True, verbose_name='parent'), + preserve_default=True, + ), + migrations.AddField( + model_name='book', + name='project', + field=models.ForeignKey(blank=True, to='catalogue.Project', null=True), + preserve_default=True, + ), + migrations.CreateModel( + name='User', + fields=[ + ], + options={ + 'proxy': True, + }, + bases=('auth.user',), + ), + ] diff --git a/src/catalogue/migrations/0002_stages.py b/src/catalogue/migrations/0002_stages.py deleted file mode 100644 index 71554570..00000000 --- a/src/catalogue/migrations/0002_stages.py +++ /dev/null @@ -1,122 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import DataMigration -from django.db import models - -class Migration(DataMigration): - - def forwards(self, orm): - - from django.core.management import call_command - call_command("loaddata", "stages.json") - - - def backwards(self, orm): - "Write your backwards methods here." - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - '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'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['parent_number', 'title']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) - }, - 'catalogue.bookpublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'}, - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) - }, - 'catalogue.chunk': { - 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_documents'", 'null': 'True', 'to': "orm['auth.User']"}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.chunkchange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"}) - }, - 'catalogue.chunkpublishrecord': { - 'Meta': {'object_name': 'ChunkPublishRecord'}, - 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}), - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/src/catalogue/migrations/0003_from_hg.py b/src/catalogue/migrations/0003_from_hg.py deleted file mode 100644 index e542d508..00000000 --- a/src/catalogue/migrations/0003_from_hg.py +++ /dev/null @@ -1,281 +0,0 @@ -# encoding: utf-8 -import datetime -from zlib import compress -import os -import os.path -import re -import urllib - -from django.db import models -from south.db import db -from south.v2 import DataMigration - -from django.conf import settings -from slugify import slugify - -META_REGEX = re.compile(r'\s*', re.DOTALL | re.MULTILINE) -STAGE_TAGS_RE = re.compile(r'^#stage-finished: (.*)$', re.MULTILINE) -AUTHOR_RE = re.compile(r'\s*(.*?)\s*<(.*)>\s*') - - -def urlunquote(url): - """Unqotes URL - - # >>> urlunquote('Za%C5%BC%C3%B3%C5%82%C4%87_g%C4%99%C5%9Bl%C4%85_ja%C5%BA%C5%84') - # u'Za\u017c\xf3\u0142\u0107_g\u0119\u015bl\u0105 ja\u017a\u0144' - """ - return unicode(urllib.unquote(url), 'utf-8', 'ignore') - - -def split_name(name): - parts = name.split('__') - return parts - - -def file_to_title(fname): - """ Returns a title-like version of a filename. """ - parts = (p.replace('_', ' ').title() for p in fname.split('__')) - return ' / '.join(parts) - - -def plain_text(text): - return re.sub(META_REGEX, '', text, 1) - - -def gallery(slug, text): - result = {} - - m = re.match(META_REGEX, text) - if m: - for line in m.group(1).split('\n'): - try: - k, v = line.split(':', 1) - result[k.strip()] = v.strip() - except ValueError: - continue - - gallery = result.get('gallery', slugify(slug)) - - if gallery.startswith('/'): - gallery = os.path.basename(gallery) - - return gallery - - -def migrate_file_from_hg(orm, fname, entry): - fname = urlunquote(fname) - print fname - if fname.endswith('.xml'): - fname = fname[:-4] - title = file_to_title(fname) - fname = slugify(fname) - - # create all the needed objects - # what if it already exists? - book = orm.Book.objects.create( - title=title, - slug=fname) - chunk = orm.Chunk.objects.create( - book=book, - number=1, - slug='1') - try: - chunk.stage = orm.ChunkTag.objects.order_by('ordering')[0] - except IndexError: - chunk.stage = None - - maxrev = entry.filerev() - gallery_link = None - - # this will fail if directory exists - os.makedirs(os.path.join(settings.CATALOGUE_REPO_PATH, str(chunk.pk))) - - for rev in xrange(maxrev + 1): - fctx = entry.filectx(rev) - data = fctx.data() - gallery_link = gallery(fname, data) - data = plain_text(data) - - # get tags from description - description = fctx.description().decode("utf-8", 'replace') - tags = STAGE_TAGS_RE.findall(description) - tags = [orm.ChunkTag.objects.get(slug=slug.strip()) for slug in tags] - - if tags: - max_ordering = max(tags, key=lambda x: x.ordering).ordering - try: - chunk.stage = orm.ChunkTag.objects.filter(ordering__gt=max_ordering).order_by('ordering')[0] - except IndexError: - chunk.stage = None - - description = STAGE_TAGS_RE.sub('', description) - - author = author_name = author_email = None - author_desc = fctx.user().decode("utf-8", 'replace') - m = AUTHOR_RE.match(author_desc) - if m: - try: - author = orm['auth.User'].objects.get(username=m.group(1), email=m.group(2)) - except orm['auth.User'].DoesNotExist: - author_name = m.group(1) - author_email = m.group(2) - else: - author_name = author_desc - - head = orm.ChunkChange.objects.create( - tree=chunk, - revision=rev + 1, - created_at=datetime.datetime.fromtimestamp(fctx.date()[0]), - description=description, - author=author, - author_name=author_name, - author_email=author_email, - parent=chunk.head - ) - - path = "%d/%d" % (chunk.pk, head.pk) - abs_path = os.path.join(settings.CATALOGUE_REPO_PATH, path) - f = open(abs_path, 'wb') - f.write(compress(data)) - f.close() - head.data = path - - head.tags = tags - head.save() - - chunk.head = head - - chunk.save() - if gallery_link: - book.gallery = gallery_link - book.save() - - -class Migration(DataMigration): - - def forwards(self, orm): - try: - hg_path = settings.WIKI_REPOSITORY_PATH - except: - print 'repository not configured, skipping' - else: - from mercurial import hg, ui - - print 'migrate from', hg_path - repo = hg.repository(ui.ui(), hg_path) - tip = repo['tip'] - for fname in tip: - if fname.startswith('.'): - continue - migrate_file_from_hg(orm, fname, tip[fname]) - - - def backwards(self, orm): - "Write your backwards methods here." - pass - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - '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'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['parent_number', 'title']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) - }, - 'catalogue.bookpublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'}, - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) - }, - 'catalogue.chunk': { - 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_documents'", 'null': 'True', 'to': "orm['auth.User']"}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.chunkchange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"}) - }, - 'catalogue.chunkpublishrecord': { - 'Meta': {'object_name': 'ChunkPublishRecord'}, - 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}), - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/src/catalogue/migrations/0004_fix_revisions.py b/src/catalogue/migrations/0004_fix_revisions.py deleted file mode 100644 index fe5c86be..00000000 --- a/src/catalogue/migrations/0004_fix_revisions.py +++ /dev/null @@ -1,125 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import DataMigration -from django.db import models - -class Migration(DataMigration): - - def forwards(self, orm): - "Make sure all revisions start with 1, not 0." - for zero_commit in orm.ChunkChange.objects.filter(revision=0): - for change in zero_commit.tree.change_set.all().order_by('-revision'): - change.revision=models.F('revision') + 1 - change.save() - - - def backwards(self, orm): - "Write your backwards methods here." - pass - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - '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'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['parent_number', 'title']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) - }, - 'catalogue.bookpublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'}, - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) - }, - 'catalogue.chunk': { - 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_chunk'", 'null': 'True', 'to': "orm['auth.User']"}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.chunkchange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"}) - }, - 'catalogue.chunkpublishrecord': { - 'Meta': {'object_name': 'ChunkPublishRecord'}, - 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}), - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/src/catalogue/migrations/0005_auto__add_field_chunk_gallery_start.py b/src/catalogue/migrations/0005_auto__add_field_chunk_gallery_start.py deleted file mode 100644 index 71af5f6c..00000000 --- a/src/catalogue/migrations/0005_auto__add_field_chunk_gallery_start.py +++ /dev/null @@ -1,125 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'Chunk.gallery_start' - db.add_column('catalogue_chunk', 'gallery_start', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'Chunk.gallery_start' - db.delete_column('catalogue_chunk', 'gallery_start') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - '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'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['parent_number', 'title']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) - }, - 'catalogue.bookpublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'}, - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) - }, - 'catalogue.chunk': { - 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_chunk'", 'null': 'True', 'to': "orm['auth.User']"}), - 'gallery_start': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.chunkchange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"}) - }, - 'catalogue.chunkpublishrecord': { - 'Meta': {'object_name': 'ChunkPublishRecord'}, - 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}), - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/src/catalogue/migrations/0006_auto__add_field_book_public.py b/src/catalogue/migrations/0006_auto__add_field_book_public.py deleted file mode 100644 index fd1cea56..00000000 --- a/src/catalogue/migrations/0006_auto__add_field_book_public.py +++ /dev/null @@ -1,126 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'Book.public' - db.add_column('catalogue_book', 'public', self.gf('django.db.models.fields.BooleanField')(default=True, db_index=True), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'Book.public' - db.delete_column('catalogue_book', 'public') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - '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'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['title', 'slug']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) - }, - 'catalogue.bookpublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'}, - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) - }, - 'catalogue.chunk': { - 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_chunk'", 'null': 'True', 'to': "orm['auth.User']"}), - 'gallery_start': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.chunkchange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"}) - }, - 'catalogue.chunkpublishrecord': { - 'Meta': {'object_name': 'ChunkPublishRecord'}, - 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}), - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/src/catalogue/migrations/0007_auto__add_field_book_dc_slug.py b/src/catalogue/migrations/0007_auto__add_field_book_dc_slug.py deleted file mode 100644 index 5ae20ea3..00000000 --- a/src/catalogue/migrations/0007_auto__add_field_book_dc_slug.py +++ /dev/null @@ -1,127 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'Book.dc_slug' - db.add_column('catalogue_book', 'dc_slug', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'Book.dc_slug' - db.delete_column('catalogue_book', 'dc_slug') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - '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'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['title', 'slug']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'dc_slug': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) - }, - 'catalogue.bookpublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'}, - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) - }, - 'catalogue.chunk': { - 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_chunk'", 'null': 'True', 'to': "orm['auth.User']"}), - 'gallery_start': ('django.db.models.fields.IntegerField', [], {'default': '1', 'null': 'True', 'blank': 'True'}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.chunkchange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"}) - }, - 'catalogue.chunkpublishrecord': { - 'Meta': {'object_name': 'ChunkPublishRecord'}, - 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}), - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/src/catalogue/migrations/0008_auto.py b/src/catalogue/migrations/0008_auto.py deleted file mode 100644 index 5276b27b..00000000 --- a/src/catalogue/migrations/0008_auto.py +++ /dev/null @@ -1,127 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding index on 'Book', fields ['dc_slug'] - db.create_index('catalogue_book', ['dc_slug']) - - - def backwards(self, orm): - - # Removing index on 'Book', fields ['dc_slug'] - db.delete_index('catalogue_book', ['dc_slug']) - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - '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'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['title', 'slug']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'dc_slug': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) - }, - 'catalogue.bookpublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'}, - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) - }, - 'catalogue.chunk': { - 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_chunk'", 'null': 'True', 'to': "orm['auth.User']"}), - 'gallery_start': ('django.db.models.fields.IntegerField', [], {'default': '1', 'null': 'True', 'blank': 'True'}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.chunkchange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"}) - }, - 'catalogue.chunkpublishrecord': { - 'Meta': {'object_name': 'ChunkPublishRecord'}, - 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}), - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/src/catalogue/migrations/0009_auto__add_field_book__on_track.py b/src/catalogue/migrations/0009_auto__add_field_book__on_track.py deleted file mode 100644 index f0509c42..00000000 --- a/src/catalogue/migrations/0009_auto__add_field_book__on_track.py +++ /dev/null @@ -1,128 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'Book._on_track' - db.add_column('catalogue_book', '_on_track', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'Book._on_track' - db.delete_column('catalogue_book', '_on_track') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - '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'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['title', 'slug']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_on_track': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'dc_slug': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) - }, - 'catalogue.bookpublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'}, - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) - }, - 'catalogue.chunk': { - 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_chunk'", 'null': 'True', 'to': "orm['auth.User']"}), - 'gallery_start': ('django.db.models.fields.IntegerField', [], {'default': '1', 'null': 'True', 'blank': 'True'}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.chunkchange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"}) - }, - 'catalogue.chunkpublishrecord': { - 'Meta': {'object_name': 'ChunkPublishRecord'}, - 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}), - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/src/catalogue/migrations/0010_auto__add_field_book_dc_cover_image.py b/src/catalogue/migrations/0010_auto__add_field_book_dc_cover_image.py deleted file mode 100644 index aebbed95..00000000 --- a/src/catalogue/migrations/0010_auto__add_field_book_dc_cover_image.py +++ /dev/null @@ -1,144 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - depends_on = ( - ("cover", "0001_initial"), - ) - - def forwards(self, orm): - # Adding field 'Book.dc_cover_image' - db.add_column('catalogue_book', 'dc_cover_image', - self.gf('django.db.models.fields.related.ForeignKey')(to=orm['cover.Image'], null=True, on_delete=models.SET_NULL, blank=True), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Book.dc_cover_image' - db.delete_column('catalogue_book', 'dc_cover_image_id') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - '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'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['title', 'slug']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_on_track': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'dc_cover_image': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cover.Image']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}), - 'dc_slug': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) - }, - 'catalogue.bookpublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'}, - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) - }, - 'catalogue.chunk': { - 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_chunk'", 'null': 'True', 'to': "orm['auth.User']"}), - 'gallery_start': ('django.db.models.fields.IntegerField', [], {'default': '1', 'null': 'True', 'blank': 'True'}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.chunkchange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"}) - }, - 'catalogue.chunkpublishrecord': { - 'Meta': {'object_name': 'ChunkPublishRecord'}, - 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}), - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'cover.image': { - 'Meta': {'object_name': 'Image'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'download_url': ('django.db.models.fields.URLField', [], {'unique': 'True', 'max_length': '200'}), - 'file': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'license_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'license_url': ('django.db.models.fields.URLField', [], {'max_length': '255', 'blank': 'True'}), - 'source_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['catalogue'] \ No newline at end of file diff --git a/src/catalogue/migrations/0011_auto__add_project__add_field_book_project.py b/src/catalogue/migrations/0011_auto__add_project__add_field_book_project.py deleted file mode 100644 index 6f30cb4f..00000000 --- a/src/catalogue/migrations/0011_auto__add_project__add_field_book_project.py +++ /dev/null @@ -1,159 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'Project' - db.create_table(u'catalogue_project', ( - (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)), - ('notes', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), - )) - db.send_create_signal('catalogue', ['Project']) - - # Adding field 'Book.project' - db.add_column(u'catalogue_book', 'project', - self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.Project'], null=True), - keep_default=False) - - - def backwards(self, orm): - # Deleting model 'Project' - db.delete_table(u'catalogue_project') - - # Deleting field 'Book.project' - db.delete_column(u'catalogue_book', 'project_id') - - - models = { - u'auth.group': { - 'Meta': {'object_name': 'Group'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - u'auth.permission': { - 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - u'auth.user': { - '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'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 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', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['title', 'slug']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_on_track': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'dc_cover_image': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['cover.Image']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}), - 'dc_slug': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Project']", 'null': 'True'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) - }, - 'catalogue.bookpublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'}, - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}) - }, - 'catalogue.chunk': { - 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_chunk'", 'null': 'True', 'to': u"orm['auth.User']"}), - 'gallery_start': ('django.db.models.fields.IntegerField', [], {'default': '1', 'null': 'True', 'blank': 'True'}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.chunkchange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"}) - }, - 'catalogue.chunkpublishrecord': { - 'Meta': {'object_name': 'ChunkPublishRecord'}, - 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}), - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.project': { - 'Meta': {'ordering': "['name']", 'object_name': 'Project'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), - 'notes': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) - }, - u'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - u'cover.image': { - 'Meta': {'object_name': 'Image'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'download_url': ('django.db.models.fields.URLField', [], {'unique': 'True', 'max_length': '200'}), - 'file': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'license_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'license_url': ('django.db.models.fields.URLField', [], {'max_length': '255', 'blank': 'True'}), - 'source_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['catalogue'] \ No newline at end of file diff --git a/src/catalogue/migrations/0012_auto__add_imagepublishrecord__add_imagechange__add_unique_imagechange_.py b/src/catalogue/migrations/0012_auto__add_imagepublishrecord__add_imagechange__add_unique_imagechange_.py deleted file mode 100644 index 599e103e..00000000 --- a/src/catalogue/migrations/0012_auto__add_imagepublishrecord__add_imagechange__add_unique_imagechange_.py +++ /dev/null @@ -1,270 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'ImagePublishRecord' - db.create_table(u'catalogue_imagepublishrecord', ( - (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('image', self.gf('django.db.models.fields.related.ForeignKey')(related_name='publish_log', to=orm['catalogue.Image'])), - ('timestamp', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), - ('change', self.gf('django.db.models.fields.related.ForeignKey')(related_name='publish_log', to=orm['catalogue.ImageChange'])), - )) - db.send_create_signal('catalogue', ['ImagePublishRecord']) - - # Adding model 'ImageChange' - db.create_table(u'catalogue_imagechange', ( - (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)), - ('author_name', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)), - ('author_email', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)), - ('revision', self.gf('django.db.models.fields.IntegerField')(db_index=True)), - ('parent', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='children', null=True, blank=True, to=orm['catalogue.ImageChange'])), - ('merge_parent', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='merge_children', null=True, blank=True, to=orm['catalogue.ImageChange'])), - ('description', self.gf('django.db.models.fields.TextField')(default='', blank=True)), - ('created_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, db_index=True)), - ('publishable', self.gf('django.db.models.fields.BooleanField')(default=False)), - ('tree', self.gf('django.db.models.fields.related.ForeignKey')(related_name='change_set', to=orm['catalogue.Image'])), - ('data', self.gf('django.db.models.fields.files.FileField')(max_length=100)), - )) - db.send_create_signal('catalogue', ['ImageChange']) - - # Adding M2M table for field tags on 'ImageChange' - db.create_table(u'catalogue_imagechange_tags', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('imagechange', models.ForeignKey(orm['catalogue.imagechange'], null=False)), - ('imagetag', models.ForeignKey(orm['catalogue.imagetag'], null=False)) - )) - db.create_unique(u'catalogue_imagechange_tags', ['imagechange_id', 'imagetag_id']) - - # Adding unique constraint on 'ImageChange', fields ['tree', 'revision'] - db.create_unique(u'catalogue_imagechange', ['tree_id', 'revision']) - - # Adding model 'ImageTag' - db.create_table(u'catalogue_imagetag', ( - (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=64)), - ('slug', self.gf('django.db.models.fields.SlugField')(max_length=64, unique=True, null=True, blank=True)), - ('ordering', self.gf('django.db.models.fields.IntegerField')()), - )) - db.send_create_signal('catalogue', ['ImageTag']) - - # Adding model 'Image' - db.create_table(u'catalogue_image', ( - (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)), - ('image', self.gf('django.db.models.fields.files.FileField')(max_length=100)), - ('title', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)), - ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50)), - ('public', self.gf('django.db.models.fields.BooleanField')(default=True, db_index=True)), - ('_short_html', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), - ('_new_publishable', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), - ('_published', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), - ('_changed', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), - ('stage', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.ImageTag'], null=True, blank=True)), - ('head', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['catalogue.ImageChange'], null=True, blank=True)), - ('creator', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='created_image', null=True, to=orm['auth.User'])), - )) - db.send_create_signal('catalogue', ['Image']) - - - def backwards(self, orm): - # Removing unique constraint on 'ImageChange', fields ['tree', 'revision'] - db.delete_unique(u'catalogue_imagechange', ['tree_id', 'revision']) - - # Deleting model 'ImagePublishRecord' - db.delete_table(u'catalogue_imagepublishrecord') - - # Deleting model 'ImageChange' - db.delete_table(u'catalogue_imagechange') - - # Removing M2M table for field tags on 'ImageChange' - db.delete_table('catalogue_imagechange_tags') - - # Deleting model 'ImageTag' - db.delete_table(u'catalogue_imagetag') - - # Deleting model 'Image' - db.delete_table(u'catalogue_image') - - - models = { - u'auth.group': { - 'Meta': {'object_name': 'Group'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - u'auth.permission': { - 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - u'auth.user': { - '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'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 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', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['title', 'slug']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_on_track': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'dc_cover_image': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['cover.Image']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}), - 'dc_slug': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Project']", 'null': 'True', 'blank': 'True'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) - }, - 'catalogue.bookpublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'}, - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}) - }, - 'catalogue.chunk': { - 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_chunk'", 'null': 'True', 'to': u"orm['auth.User']"}), - 'gallery_start': ('django.db.models.fields.IntegerField', [], {'default': '1', 'null': 'True', 'blank': 'True'}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.chunkchange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"}) - }, - 'catalogue.chunkpublishrecord': { - 'Meta': {'object_name': 'ChunkPublishRecord'}, - 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}), - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.image': { - 'Meta': {'ordering': "['title']", 'object_name': 'Image'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_image'", 'null': 'True', 'to': u"orm['auth.User']"}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ImageChange']", 'null': 'True', 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'image': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ImageTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.imagechange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ImageChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ImageChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ImageChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ImageTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Image']"}) - }, - 'catalogue.imagepublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'ImagePublishRecord'}, - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ImageChange']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'image': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Image']"}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}) - }, - 'catalogue.imagetag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ImageTag'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.project': { - 'Meta': {'ordering': "['name']", 'object_name': 'Project'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), - 'notes': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) - }, - u'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - u'cover.image': { - 'Meta': {'object_name': 'Image'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'download_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'unique': 'True', 'null': 'True', 'blank': 'True'}), - 'file': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'license_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'license_url': ('django.db.models.fields.URLField', [], {'max_length': '255', 'blank': 'True'}), - 'source_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['catalogue'] \ No newline at end of file diff --git a/src/catalogue/migrations/0013_auto__add_field_image_project.py b/src/catalogue/migrations/0013_auto__add_field_image_project.py deleted file mode 100644 index 6ae3564f..00000000 --- a/src/catalogue/migrations/0013_auto__add_field_image_project.py +++ /dev/null @@ -1,196 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Image.project' - db.add_column(u'catalogue_image', 'project', - self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.Project'], null=True, blank=True), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Image.project' - db.delete_column(u'catalogue_image', 'project_id') - - - models = { - u'auth.group': { - 'Meta': {'object_name': 'Group'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - u'auth.permission': { - 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - u'auth.user': { - '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'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 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', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['title', 'slug']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_on_track': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'dc_cover_image': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['cover.Image']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}), - 'dc_slug': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Project']", 'null': 'True', 'blank': 'True'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) - }, - 'catalogue.bookpublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'}, - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}) - }, - 'catalogue.chunk': { - 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_chunk'", 'null': 'True', 'to': u"orm['auth.User']"}), - 'gallery_start': ('django.db.models.fields.IntegerField', [], {'default': '1', 'null': 'True', 'blank': 'True'}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.chunkchange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"}) - }, - 'catalogue.chunkpublishrecord': { - 'Meta': {'object_name': 'ChunkPublishRecord'}, - 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}), - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.image': { - 'Meta': {'ordering': "['title']", 'object_name': 'Image'}, - '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), - '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_image'", 'null': 'True', 'to': u"orm['auth.User']"}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ImageChange']", 'null': 'True', 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'image': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Project']", 'null': 'True', 'blank': 'True'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}), - 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ImageTag']", 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.imagechange': { - 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ImageChange'}, - 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), - 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ImageChange']"}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ImageChange']"}), - 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), - 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ImageTag']"}), - 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Image']"}) - }, - 'catalogue.imagepublishrecord': { - 'Meta': {'ordering': "['-timestamp']", 'object_name': 'ImagePublishRecord'}, - 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ImageChange']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'image': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Image']"}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}) - }, - 'catalogue.imagetag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ImageTag'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), - 'ordering': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - 'catalogue.project': { - 'Meta': {'ordering': "['name']", 'object_name': 'Project'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), - 'notes': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) - }, - u'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - u'cover.image': { - 'Meta': {'object_name': 'Image'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'download_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'unique': 'True', 'null': 'True', 'blank': 'True'}), - 'file': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'license_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'license_url': ('django.db.models.fields.URLField', [], {'max_length': '255', 'blank': 'True'}), - 'source_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['catalogue'] \ No newline at end of file diff --git a/src/catalogue/templatetags/book_list.py b/src/catalogue/templatetags/book_list.py index 9ac996b8..a916f30a 100755 --- a/src/catalogue/templatetags/book_list.py +++ b/src/catalogue/templatetags/book_list.py @@ -12,12 +12,7 @@ register = template.Library() class ChunksList(object): def __init__(self, chunk_qs): - #self.chunk_qs = chunk_qs#.annotate( - #book_length=Count('book__chunk')).select_related( - #'book')#, 'stage__name', - #'user') - self.chunk_qs = chunk_qs.select_related('book__hidden') - + self.chunk_qs = chunk_qs.select_related('book') self.book_qs = chunk_qs.values('book_id') def __getitem__(self, key): diff --git a/src/catalogue/templatetags/wall.py b/src/catalogue/templatetags/wall.py index d000421a..0c1628ce 100755 --- a/src/catalogue/templatetags/wall.py +++ b/src/catalogue/templatetags/wall.py @@ -3,7 +3,6 @@ from __future__ import absolute_import from datetime import timedelta from django.db.models import Q from django.core.urlresolvers import reverse -from django.contrib.comments.models import Comment from django import template from django.utils.translation import ugettext as _ @@ -33,7 +32,7 @@ class WallItem(object): def changes_wall(user=None, max_len=None, day=None): qs = Chunk.change_model.objects.order_by('-created_at') - qs = qs.select_related('author', 'tree', 'tree__book__title') + qs = qs.select_related('author', 'tree', 'tree__book') if user is not None: qs = qs.filter(Q(author=user) | Q(tree__user=user)) if max_len is not None: @@ -62,7 +61,7 @@ def changes_wall(user=None, max_len=None, day=None): def image_changes_wall(user=None, max_len=None, day=None): qs = Image.change_model.objects.order_by('-created_at') - qs = qs.select_related('author', 'tree', 'tree__title') + qs = qs.select_related('author', 'tree') if user is not None: qs = qs.filter(Q(author=user) | Q(tree__user=user)) if max_len is not None: @@ -94,7 +93,7 @@ def image_changes_wall(user=None, max_len=None, day=None): def published_wall(user=None, max_len=None, day=None): - qs = BookPublishRecord.objects.select_related('book__title') + qs = BookPublishRecord.objects.select_related('book') if user: # TODO: published my book qs = qs.filter(Q(user=user)) @@ -115,7 +114,7 @@ def published_wall(user=None, max_len=None, day=None): def image_published_wall(user=None, max_len=None, day=None): - qs = ImagePublishRecord.objects.select_related('image__title') + qs = ImagePublishRecord.objects.select_related('image') if user: # TODO: published my book qs = qs.filter(Q(user=user)) @@ -135,30 +134,6 @@ def image_published_wall(user=None, max_len=None, day=None): yield w -def comments_wall(user=None, max_len=None, day=None): - qs = Comment.objects.filter(is_public=True).select_related().order_by('-submit_date') - if user: - # TODO: comments concerning my books - qs = qs.filter(Q(user=user)) - if max_len is not None: - qs = qs[:max_len] - if day is not None: - next_day = day + timedelta(1) - qs = qs.filter(submit_date__gte=day, submit_date__lt=next_day) - for item in qs: - w = WallItem('comment') - w.header = _('Comment') - w.title = item.content_object - w.summary = item.comment - w.url = item.content_object.get_absolute_url() - w.timestamp = item.submit_date - w.user = item.user - ui = item.userinfo - w.email = item.email - w.user_name = item.name - yield w - - def big_wall(walls, max_len=None): """ Takes some WallItem iterators and zips them into one big wall. @@ -193,7 +168,6 @@ def wall(context, user=None, max_len=100): published_wall(user, max_len), image_changes_wall(user, max_len), image_published_wall(user, max_len), - comments_wall(user, max_len), ], max_len)} @register.inclusion_tag("catalogue/wall.html", takes_context=True) @@ -206,5 +180,4 @@ def day_wall(context, day): published_wall(day=day), image_changes_wall(day=day), image_published_wall(day=day), - comments_wall(day=day), ])} diff --git a/src/catalogue/tests/__init__.py b/src/catalogue/tests/__init__.py index 533a6c53..e69de29b 100644 --- a/src/catalogue/tests/__init__.py +++ b/src/catalogue/tests/__init__.py @@ -1,9 +0,0 @@ -# -*- coding: utf-8 -*- -# -# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -from catalogue.tests.book import * -from catalogue.tests.gallery import * -from catalogue.tests.publish import * -from catalogue.tests.xml_updater import * diff --git a/src/catalogue/tests/book.py b/src/catalogue/tests/book.py deleted file mode 100644 index df6f3b4f..00000000 --- a/src/catalogue/tests/book.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# -# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -"""Tests for manipulating books in the catalogue.""" - -from django.test import TestCase -from django.contrib.auth.models import User -from catalogue.models import Book - - -class ManipulationTests(TestCase): - - def setUp(self): - self.user = User.objects.create(username='tester') - self.book1 = Book.create(self.user, 'book 1', slug='book1') - self.book2 = Book.create(self.user, 'book 2', slug='book2') - - def test_append(self): - self.book1.append(self.book2) - self.assertEqual(Book.objects.all().count(), 1) - self.assertEqual(len(self.book1), 2) - - def test_append_to_self(self): - with self.assertRaises(AssertionError): - self.book1.append(Book.objects.get(pk=self.book1.pk)) - self.assertEqual(Book.objects.all().count(), 2) - self.assertEqual(len(self.book1), 1) - - def test_prepend_history(self): - self.book1.prepend_history(self.book2) - self.assertEqual(Book.objects.all().count(), 1) - self.assertEqual(len(self.book1), 1) - self.assertEqual(self.book1.materialize(), 'book 1') - - def test_prepend_history_to_self(self): - with self.assertRaises(AssertionError): - self.book1.prepend_history(self.book1) - self.assertEqual(Book.objects.all().count(), 2) - self.assertEqual(self.book1.materialize(), 'book 1') - self.assertEqual(self.book2.materialize(), 'book 2') - - def test_split_book(self): - self.book1.chunk_set.create(number=2, title='Second chunk', - slug='book3') - self.book1[1].commit('I survived!') - self.assertEqual(len(self.book1), 2) - self.book1.split() - self.assertEqual(set([b.slug for b in Book.objects.all()]), - set(['book2', '1', 'book3'])) - self.assertEqual( - Book.objects.get(slug='book3').materialize(), - 'I survived!') diff --git a/src/catalogue/tests/gallery.py b/src/catalogue/tests/gallery.py deleted file mode 100644 index 4b8ea3f4..00000000 --- a/src/catalogue/tests/gallery.py +++ /dev/null @@ -1,148 +0,0 @@ -# -*- coding: utf-8 -*- -# -# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -"""Tests for galleries of scans.""" - -from os.path import join, basename, exists -from os import makedirs, listdir -from django.test import TestCase -from django.contrib.auth.models import User -from catalogue.models import Book -from tempfile import mkdtemp -from django.conf import settings - - -class GalleryAppendTests(TestCase): - def setUp(self): - self.user = User.objects.create(username='tester') - self.book1 = Book.create(self.user, 'book 1', slug='book1') - self.book1.chunk_set.create(number=2, title='Second chunk', - slug='book1-2') - c=self.book1[1] - c.gallery_start=3 - - self.scandir = join(settings.MEDIA_ROOT, settings.IMAGE_DIR) - if not exists(self.scandir): - makedirs(self.scandir) - - def make_gallery(self, book, files): - d = mkdtemp('gallery', dir=self.scandir) - for named, cont in files.items(): - f = open(join(d, named), 'w') - f.write(cont) - f.close() - book.gallery = basename(d) - - - def test_both_indexed(self): - self.book2 = Book.create(self.user, 'book 2', slug='book2') - self.book2.chunk_set.create(number=2, title='Second chunk of second book', - slug='book2-2') - - c = self.book2[1] - c.gallery_start = 3 - c.save() - - print "gallery starts:",self.book2[0].gallery_start, self.book2[1].gallery_start - - self.make_gallery(self.book1, { - '1-0001_1l' : 'aa', - '1-0001_2r' : 'bb', - '1-0002_1l' : 'cc', - '1-0002_2r' : 'dd', - }) - - self.make_gallery(self.book2, { - '1-0001_1l' : 'dd', # the same, should not be moved - '1-0001_2r' : 'ff', - '2-0002_1l' : 'gg', - '2-0002_2r' : 'hh', - }) - - self.book1.append(self.book2) - - files = listdir(join(self.scandir, self.book1.gallery)) - files.sort() - print files - self.assertEqual(files, [ - '1-0001_1l', - '1-0001_2r', - '1-0002_1l', - '1-0002_2r', - # '2-0001_1l', - '2-0001_2r', - '3-0002_1l', - '3-0002_2r', - ]) - - self.assertEqual((4, 6), (self.book1[2].gallery_start, self.book1[3].gallery_start)) - - - def test_none_indexed(self): - self.book2 = Book.create(self.user, 'book 2', slug='book2') - self.make_gallery(self.book1, { - '0001_1l' : 'aa', - '0001_2r' : 'bb', - '0002_1l' : 'cc', - '0002_2r' : 'dd', - }) - - self.make_gallery(self.book2, { - '0001_1l' : 'ee', - '0001_2r' : 'ff', - '0002_1l' : 'gg', - '0002_2r' : 'hh', - }) - - self.book1.append(self.book2) - - files = listdir(join(self.scandir, self.book1.gallery)) - files.sort() - print files - self.assertEqual(files, [ - '0-0001_1l', - '0-0001_2r', - '0-0002_1l', - '0-0002_2r', - '1-0001_1l', - '1-0001_2r', - '1-0002_1l', - '1-0002_2r', - ]) - - - def test_none_indexed(self): - import nose.tools - self.book2 = Book.create(self.user, 'book 2', slug='book2') - self.make_gallery(self.book1, { - '1-0001_1l' : 'aa', - '1-0001_2r' : 'bb', - '1002_1l' : 'cc', - '1002_2r' : 'dd', - }) - - self.make_gallery(self.book2, { - '0001_1l' : 'ee', - '0001_2r' : 'ff', - '0002_1l' : 'gg', - '0002_2r' : 'hh', - }) - - self.book1.append(self.book2) - - files = listdir(join(self.scandir, self.book1.gallery)) - files.sort() - print files - self.assertEqual(files, [ - '0-1-0001_1l', - '0-1-0001_2r', - '0-1002_1l', - '0-1002_2r', - '1-0001_1l', - '1-0001_2r', - '1-0002_1l', - '1-0002_2r', - ]) - diff --git a/src/catalogue/tests/publish.py b/src/catalogue/tests/publish.py deleted file mode 100644 index 93e02daa..00000000 --- a/src/catalogue/tests/publish.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- -# -# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -"""Tests for the publishing process.""" - -from catalogue.test_utils import get_fixture - -from mock import patch -from django.test import TestCase -from django.contrib.auth.models import User -from catalogue.models import Book - - -class PublishTests(TestCase): - def setUp(self): - self.user = User.objects.create(username='tester') - self.text1 = get_fixture('chunk1.xml') - self.book = Book.create(self.user, self.text1, slug='test-book') - - @patch('apiclient.api_call') - def test_unpublishable(self, api_call): - with self.assertRaises(AssertionError): - self.book.publish(self.user) - - @patch('apiclient.api_call') - def test_publish(self, api_call): - self.book[0].head.set_publishable(True) - self.book.publish(self.user) - api_call.assert_called_with(self.user, 'books/', {"book_xml": self.text1, "days": 0}, beta=False) - - @patch('apiclient.api_call') - def test_publish_multiple(self, api_call): - self.book[0].head.set_publishable(True) - self.book[0].split(slug='part-2') - self.book[1].commit(get_fixture('chunk2.xml')) - self.book[1].head.set_publishable(True) - self.book.publish(self.user) - api_call.assert_called_with(self.user, 'books/', {"book_xml": get_fixture('expected.xml'), "days": 0}, beta=False) diff --git a/src/catalogue/tests/test_book.py b/src/catalogue/tests/test_book.py new file mode 100644 index 00000000..df6f3b4f --- /dev/null +++ b/src/catalogue/tests/test_book.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# +# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# +"""Tests for manipulating books in the catalogue.""" + +from django.test import TestCase +from django.contrib.auth.models import User +from catalogue.models import Book + + +class ManipulationTests(TestCase): + + def setUp(self): + self.user = User.objects.create(username='tester') + self.book1 = Book.create(self.user, 'book 1', slug='book1') + self.book2 = Book.create(self.user, 'book 2', slug='book2') + + def test_append(self): + self.book1.append(self.book2) + self.assertEqual(Book.objects.all().count(), 1) + self.assertEqual(len(self.book1), 2) + + def test_append_to_self(self): + with self.assertRaises(AssertionError): + self.book1.append(Book.objects.get(pk=self.book1.pk)) + self.assertEqual(Book.objects.all().count(), 2) + self.assertEqual(len(self.book1), 1) + + def test_prepend_history(self): + self.book1.prepend_history(self.book2) + self.assertEqual(Book.objects.all().count(), 1) + self.assertEqual(len(self.book1), 1) + self.assertEqual(self.book1.materialize(), 'book 1') + + def test_prepend_history_to_self(self): + with self.assertRaises(AssertionError): + self.book1.prepend_history(self.book1) + self.assertEqual(Book.objects.all().count(), 2) + self.assertEqual(self.book1.materialize(), 'book 1') + self.assertEqual(self.book2.materialize(), 'book 2') + + def test_split_book(self): + self.book1.chunk_set.create(number=2, title='Second chunk', + slug='book3') + self.book1[1].commit('I survived!') + self.assertEqual(len(self.book1), 2) + self.book1.split() + self.assertEqual(set([b.slug for b in Book.objects.all()]), + set(['book2', '1', 'book3'])) + self.assertEqual( + Book.objects.get(slug='book3').materialize(), + 'I survived!') diff --git a/src/catalogue/tests/test_gallery.py b/src/catalogue/tests/test_gallery.py new file mode 100644 index 00000000..4b8ea3f4 --- /dev/null +++ b/src/catalogue/tests/test_gallery.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- +# +# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# +"""Tests for galleries of scans.""" + +from os.path import join, basename, exists +from os import makedirs, listdir +from django.test import TestCase +from django.contrib.auth.models import User +from catalogue.models import Book +from tempfile import mkdtemp +from django.conf import settings + + +class GalleryAppendTests(TestCase): + def setUp(self): + self.user = User.objects.create(username='tester') + self.book1 = Book.create(self.user, 'book 1', slug='book1') + self.book1.chunk_set.create(number=2, title='Second chunk', + slug='book1-2') + c=self.book1[1] + c.gallery_start=3 + + self.scandir = join(settings.MEDIA_ROOT, settings.IMAGE_DIR) + if not exists(self.scandir): + makedirs(self.scandir) + + def make_gallery(self, book, files): + d = mkdtemp('gallery', dir=self.scandir) + for named, cont in files.items(): + f = open(join(d, named), 'w') + f.write(cont) + f.close() + book.gallery = basename(d) + + + def test_both_indexed(self): + self.book2 = Book.create(self.user, 'book 2', slug='book2') + self.book2.chunk_set.create(number=2, title='Second chunk of second book', + slug='book2-2') + + c = self.book2[1] + c.gallery_start = 3 + c.save() + + print "gallery starts:",self.book2[0].gallery_start, self.book2[1].gallery_start + + self.make_gallery(self.book1, { + '1-0001_1l' : 'aa', + '1-0001_2r' : 'bb', + '1-0002_1l' : 'cc', + '1-0002_2r' : 'dd', + }) + + self.make_gallery(self.book2, { + '1-0001_1l' : 'dd', # the same, should not be moved + '1-0001_2r' : 'ff', + '2-0002_1l' : 'gg', + '2-0002_2r' : 'hh', + }) + + self.book1.append(self.book2) + + files = listdir(join(self.scandir, self.book1.gallery)) + files.sort() + print files + self.assertEqual(files, [ + '1-0001_1l', + '1-0001_2r', + '1-0002_1l', + '1-0002_2r', + # '2-0001_1l', + '2-0001_2r', + '3-0002_1l', + '3-0002_2r', + ]) + + self.assertEqual((4, 6), (self.book1[2].gallery_start, self.book1[3].gallery_start)) + + + def test_none_indexed(self): + self.book2 = Book.create(self.user, 'book 2', slug='book2') + self.make_gallery(self.book1, { + '0001_1l' : 'aa', + '0001_2r' : 'bb', + '0002_1l' : 'cc', + '0002_2r' : 'dd', + }) + + self.make_gallery(self.book2, { + '0001_1l' : 'ee', + '0001_2r' : 'ff', + '0002_1l' : 'gg', + '0002_2r' : 'hh', + }) + + self.book1.append(self.book2) + + files = listdir(join(self.scandir, self.book1.gallery)) + files.sort() + print files + self.assertEqual(files, [ + '0-0001_1l', + '0-0001_2r', + '0-0002_1l', + '0-0002_2r', + '1-0001_1l', + '1-0001_2r', + '1-0002_1l', + '1-0002_2r', + ]) + + + def test_none_indexed(self): + import nose.tools + self.book2 = Book.create(self.user, 'book 2', slug='book2') + self.make_gallery(self.book1, { + '1-0001_1l' : 'aa', + '1-0001_2r' : 'bb', + '1002_1l' : 'cc', + '1002_2r' : 'dd', + }) + + self.make_gallery(self.book2, { + '0001_1l' : 'ee', + '0001_2r' : 'ff', + '0002_1l' : 'gg', + '0002_2r' : 'hh', + }) + + self.book1.append(self.book2) + + files = listdir(join(self.scandir, self.book1.gallery)) + files.sort() + print files + self.assertEqual(files, [ + '0-1-0001_1l', + '0-1-0001_2r', + '0-1002_1l', + '0-1002_2r', + '1-0001_1l', + '1-0001_2r', + '1-0002_1l', + '1-0002_2r', + ]) + diff --git a/src/catalogue/tests/test_publish.py b/src/catalogue/tests/test_publish.py new file mode 100644 index 00000000..93e02daa --- /dev/null +++ b/src/catalogue/tests/test_publish.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# +# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# +"""Tests for the publishing process.""" + +from catalogue.test_utils import get_fixture + +from mock import patch +from django.test import TestCase +from django.contrib.auth.models import User +from catalogue.models import Book + + +class PublishTests(TestCase): + def setUp(self): + self.user = User.objects.create(username='tester') + self.text1 = get_fixture('chunk1.xml') + self.book = Book.create(self.user, self.text1, slug='test-book') + + @patch('apiclient.api_call') + def test_unpublishable(self, api_call): + with self.assertRaises(AssertionError): + self.book.publish(self.user) + + @patch('apiclient.api_call') + def test_publish(self, api_call): + self.book[0].head.set_publishable(True) + self.book.publish(self.user) + api_call.assert_called_with(self.user, 'books/', {"book_xml": self.text1, "days": 0}, beta=False) + + @patch('apiclient.api_call') + def test_publish_multiple(self, api_call): + self.book[0].head.set_publishable(True) + self.book[0].split(slug='part-2') + self.book[1].commit(get_fixture('chunk2.xml')) + self.book[1].head.set_publishable(True) + self.book.publish(self.user) + api_call.assert_called_with(self.user, 'books/', {"book_xml": get_fixture('expected.xml'), "days": 0}, beta=False) diff --git a/src/catalogue/tests/test_xml_updater.py b/src/catalogue/tests/test_xml_updater.py new file mode 100644 index 00000000..9fb5a4a0 --- /dev/null +++ b/src/catalogue/tests/test_xml_updater.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# +# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# +"""XmlUpdater tests.""" + +from catalogue.test_utils import get_fixture +from django.test import TestCase +from django.contrib.auth.models import User +from catalogue.models import Book +from catalogue.management import XmlUpdater +from librarian import DCNS + + +class XmlUpdaterTests(TestCase): + class SimpleUpdater(XmlUpdater): + @XmlUpdater.fixes_elements('.//' + DCNS('title')) + def fix_title(element, **kwargs): + element.text = element.text + " fixed" + return True + + def setUp(self): + self.user = User.objects.create(username='tester') + text = get_fixture('chunk1.xml') + Book.create(self.user, text, slug='test-book') + self.title = "Do M***" + + def test_xml_updater(self): + self.SimpleUpdater().run(self.user) + self.assertEqual( + Book.objects.get(slug='test-book').wldocument( + publishable=False).book_info.title, + self.title + " fixed" + ) diff --git a/src/catalogue/tests/xml_updater.py b/src/catalogue/tests/xml_updater.py deleted file mode 100644 index 9fb5a4a0..00000000 --- a/src/catalogue/tests/xml_updater.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# -# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -"""XmlUpdater tests.""" - -from catalogue.test_utils import get_fixture -from django.test import TestCase -from django.contrib.auth.models import User -from catalogue.models import Book -from catalogue.management import XmlUpdater -from librarian import DCNS - - -class XmlUpdaterTests(TestCase): - class SimpleUpdater(XmlUpdater): - @XmlUpdater.fixes_elements('.//' + DCNS('title')) - def fix_title(element, **kwargs): - element.text = element.text + " fixed" - return True - - def setUp(self): - self.user = User.objects.create(username='tester') - text = get_fixture('chunk1.xml') - Book.create(self.user, text, slug='test-book') - self.title = "Do M***" - - def test_xml_updater(self): - self.SimpleUpdater().run(self.user) - self.assertEqual( - Book.objects.get(slug='test-book').wldocument( - publishable=False).book_info.title, - self.title + " fixed" - ) diff --git a/src/catalogue/urls.py b/src/catalogue/urls.py index e81c0a36..36930607 100644 --- a/src/catalogue/urls.py +++ b/src/catalogue/urls.py @@ -1,64 +1,64 @@ # -*- coding: utf-8 -from django.conf.urls import patterns, url +from django.conf.urls import url from django.contrib.auth.decorators import permission_required from django.views.generic import RedirectView from catalogue.feeds import PublishTrackFeed -from catalogue.views import GalleryView +from . import views -urlpatterns = patterns('catalogue.views', - url(r'^$', RedirectView.as_view(url='catalogue/')), +urlpatterns = [ + url(r'^$', RedirectView.as_view(url='catalogue/', permanent=False)), - url(r'^images/$', 'image_list', name='catalogue_image_list'), - url(r'^image/(?P[^/]+)/$', 'image', name="catalogue_image"), - url(r'^image/(?P[^/]+)/publish$', 'publish_image', + url(r'^images/$', views.image_list, name='catalogue_image_list'), + url(r'^image/(?P[^/]+)/$', views.image, name="catalogue_image"), + url(r'^image/(?P[^/]+)/publish$', views.publish_image, name="catalogue_publish_image"), - url(r'^catalogue/$', 'document_list', name='catalogue_document_list'), - url(r'^user/$', 'my', name='catalogue_user'), - url(r'^user/(?P[^/]+)/$', 'user', name='catalogue_user'), - url(r'^users/$', 'users', name='catalogue_users'), - url(r'^activity/$', 'activity', name='catalogue_activity'), + url(r'^catalogue/$', views.document_list, name='catalogue_document_list'), + url(r'^user/$', views.my, name='catalogue_user'), + url(r'^user/(?P[^/]+)/$', views.user, name='catalogue_user'), + url(r'^users/$', views.users, name='catalogue_users'), + url(r'^activity/$', views.activity, name='catalogue_activity'), url(r'^activity/(?P\d{4}-\d{2}-\d{2})/$', - 'activity', name='catalogue_activity'), + views.activity, name='catalogue_activity'), url(r'^upload/$', - 'upload', name='catalogue_upload'), + views.upload, name='catalogue_upload'), url(r'^create/(?P[^/]*)/', - 'create_missing', name='catalogue_create_missing'), + views.create_missing, name='catalogue_create_missing'), url(r'^create/', - 'create_missing', name='catalogue_create_missing'), + views.create_missing, name='catalogue_create_missing'), - url(r'^book/(?P[^/]+)/publish$', 'publish', name="catalogue_publish"), + url(r'^book/(?P[^/]+)/publish$', views.publish, name="catalogue_publish"), - url(r'^book/(?P[^/]+)/$', 'book', name="catalogue_book"), + url(r'^book/(?P[^/]+)/$', views.book, name="catalogue_book"), url(r'^book/(?P[^/]+)/gallery/$', - permission_required('catalogue.change_book')(GalleryView.as_view()), + permission_required('catalogue.change_book')(views.GalleryView.as_view()), name="catalogue_book_gallery"), - url(r'^book/(?P[^/]+)/xml$', 'book_xml', name="catalogue_book_xml"), - url(r'^book/dc/(?P[^/]+)/xml$', 'book_xml_dc', name="catalogue_book_xml_dc"), - url(r'^book/(?P[^/]+)/txt$', 'book_txt', name="catalogue_book_txt"), - url(r'^book/(?P[^/]+)/html$', 'book_html', name="catalogue_book_html"), - url(r'^book/(?P[^/]+)/epub$', 'book_epub', name="catalogue_book_epub"), - url(r'^book/(?P[^/]+)/mobi$', 'book_mobi', name="catalogue_book_mobi"), - url(r'^book/(?P[^/]+)/pdf$', 'book_pdf', name="catalogue_book_pdf"), - url(r'^book/(?P[^/]+)/pdf-mobile$', 'book_pdf', kwargs={'mobile': True}, name="catalogue_book_pdf_mobile"), + url(r'^book/(?P[^/]+)/xml$', views.book_xml, name="catalogue_book_xml"), + url(r'^book/dc/(?P[^/]+)/xml$', views.book_xml_dc, name="catalogue_book_xml_dc"), + url(r'^book/(?P[^/]+)/txt$', views.book_txt, name="catalogue_book_txt"), + url(r'^book/(?P[^/]+)/html$', views.book_html, name="catalogue_book_html"), + url(r'^book/(?P[^/]+)/epub$', views.book_epub, name="catalogue_book_epub"), + url(r'^book/(?P[^/]+)/mobi$', views.book_mobi, name="catalogue_book_mobi"), + url(r'^book/(?P[^/]+)/pdf$', views.book_pdf, name="catalogue_book_pdf"), + url(r'^book/(?P[^/]+)/pdf-mobile$', views.book_pdf, kwargs={'mobile': True}, name="catalogue_book_pdf_mobile"), url(r'^chunk_add/(?P[^/]+)/(?P[^/]+)/$', - 'chunk_add', name="catalogue_chunk_add"), + views.chunk_add, name="catalogue_chunk_add"), url(r'^chunk_edit/(?P[^/]+)/(?P[^/]+)/$', - 'chunk_edit', name="catalogue_chunk_edit"), + views.chunk_edit, name="catalogue_chunk_edit"), url(r'^book_append/(?P[^/]+)/$', - 'book_append', name="catalogue_book_append"), + views.book_append, name="catalogue_book_append"), url(r'^chunk_mass_edit', - 'chunk_mass_edit', name='catalogue_chunk_mass_edit'), + views.chunk_mass_edit, name='catalogue_chunk_mass_edit'), url(r'^image_mass_edit', - 'image_mass_edit', name='catalogue_image_mass_edit'), + views.image_mass_edit, name='catalogue_image_mass_edit'), url(r'^track/(?P[^/]*)/$', PublishTrackFeed()), - url(r'^active/$', 'active_users_list', name='active_users_list'), + url(r'^active/$', views.active_users_list, name='active_users_list'), - url(r'^mark-final/$', 'mark_final', name='mark_final'), - url(r'^mark-final-completed/$', 'mark_final_completed', name='mark_final_completed'), -) + url(r'^mark-final/$', views.mark_final, name='mark_final'), + url(r'^mark-final-completed/$', views.mark_final_completed, name='mark_final_completed'), +] diff --git a/src/cover/forms.py b/src/cover/forms.py index 513bdefb..e6f7868e 100755 --- a/src/cover/forms.py +++ b/src/cover/forms.py @@ -18,6 +18,7 @@ from cover.utils import get_flickr_data, FlickrError, URLOpener class ImageAddForm(forms.ModelForm): class Meta: model = Image + exclude = [] def __init__(self, *args, **kwargs): super(ImageAddForm, self).__init__(*args, **kwargs) diff --git a/src/cover/migrations/0001_initial.py b/src/cover/migrations/0001_initial.py index f31c405f..648d53ce 100644 --- a/src/cover/migrations/0001_initial.py +++ b/src/cover/migrations/0001_initial.py @@ -1,44 +1,32 @@ # -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'Image' - db.create_table('cover_image', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('title', self.gf('django.db.models.fields.CharField')(max_length=255)), - ('author', self.gf('django.db.models.fields.CharField')(max_length=255)), - ('license_name', self.gf('django.db.models.fields.CharField')(max_length=255)), - ('license_url', self.gf('django.db.models.fields.URLField')(max_length=255, blank=True)), - ('source_url', self.gf('django.db.models.fields.URLField')(max_length=200)), - ('download_url', self.gf('django.db.models.fields.URLField')(unique=True, max_length=200)), - ('file', self.gf('django.db.models.fields.files.ImageField')(max_length=100)), - )) - db.send_create_signal('cover', ['Image']) - - - def backwards(self, orm): - # Deleting model 'Image' - db.delete_table('cover_image') - - - models = { - 'cover.image': { - 'Meta': {'object_name': 'Image'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'download_url': ('django.db.models.fields.URLField', [], {'unique': 'True', 'max_length': '200'}), - 'file': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'license_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'license_url': ('django.db.models.fields.URLField', [], {'max_length': '255', 'blank': 'True'}), - 'source_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['cover'] \ No newline at end of file +from __future__ import unicode_literals + +from django.db import models, migrations +import cover.models + + +class Migration(migrations.Migration): + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Image', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('title', models.CharField(max_length=255, verbose_name='title')), + ('author', models.CharField(max_length=255, verbose_name='author')), + ('license_name', models.CharField(max_length=255, verbose_name='license name')), + ('license_url', models.URLField(max_length=255, verbose_name='license URL', blank=True)), + ('source_url', models.URLField(null=True, verbose_name='source URL', blank=True)), + ('download_url', models.URLField(unique=True, null=True, verbose_name='image download URL', blank=True)), + ('file', models.ImageField(upload_to=b'cover/image', storage=cover.models.OverwriteStorage(), verbose_name='file')), + ], + options={ + 'verbose_name': 'cover image', + 'verbose_name_plural': 'cover images', + }, + bases=(models.Model,), + ), + ] diff --git a/src/cover/migrations/0002_auto__chg_field_image_download_url.py b/src/cover/migrations/0002_auto__chg_field_image_download_url.py deleted file mode 100644 index 8a64c39d..00000000 --- a/src/cover/migrations/0002_auto__chg_field_image_download_url.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'Image.download_url' - db.alter_column(u'cover_image', 'download_url', self.gf('django.db.models.fields.URLField')(max_length=200, unique=True, null=True)) - - def backwards(self, orm): - - # User chose to not deal with backwards NULL issues for 'Image.download_url' - raise RuntimeError("Cannot reverse this migration. 'Image.download_url' and its values cannot be restored.") - - models = { - u'cover.image': { - 'Meta': {'object_name': 'Image'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'download_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'unique': 'True', 'null': 'True'}), - 'file': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'license_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'license_url': ('django.db.models.fields.URLField', [], {'max_length': '255', 'blank': 'True'}), - 'source_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['cover'] \ No newline at end of file diff --git a/src/cover/migrations/0003_auto__chg_field_image_source_url.py b/src/cover/migrations/0003_auto__chg_field_image_source_url.py deleted file mode 100644 index 98951e35..00000000 --- a/src/cover/migrations/0003_auto__chg_field_image_source_url.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'Image.source_url' - db.alter_column(u'cover_image', 'source_url', self.gf('django.db.models.fields.URLField')(max_length=200, null=True)) - - def backwards(self, orm): - - # User chose to not deal with backwards NULL issues for 'Image.source_url' - raise RuntimeError("Cannot reverse this migration. 'Image.source_url' and its values cannot be restored.") - - models = { - u'cover.image': { - 'Meta': {'object_name': 'Image'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'download_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'unique': 'True', 'null': 'True'}), - 'file': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'license_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'license_url': ('django.db.models.fields.URLField', [], {'max_length': '255', 'blank': 'True'}), - 'source_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['cover'] \ No newline at end of file diff --git a/src/cover/urls.py b/src/cover/urls.py index 1146f62d..febe3f0f 100644 --- a/src/cover/urls.py +++ b/src/cover/urls.py @@ -3,19 +3,20 @@ # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # -from django.conf.urls import patterns, url +from django.conf.urls import url +from . import views -urlpatterns = patterns('cover.views', - url(r'^preview/$', 'preview_from_xml', name='cover_preview'), - url(r'^preview/(?P[^/]+)/$', 'preview', name='cover_preview'), +urlpatterns = [ + url(r'^preview/$', views.preview_from_xml, name='cover_preview'), + url(r'^preview/(?P[^/]+)/$', views.preview, name='cover_preview'), url(r'^preview/(?P[^/]+)/(?P[^/]+)/$', - 'preview', name='cover_preview'), + views.preview, name='cover_preview'), url(r'^preview/(?P[^/]+)/(?P[^/]+)/(?P\d+)/$', - 'preview', name='cover_preview'), + views.preview, name='cover_preview'), - url(r'^image/$', 'image_list', name='cover_image_list'), - url(r'^image/(?P\d+)/?$', 'image', name='cover_image'), - url(r'^image/(?P\d+)/file/', 'image_file', name='cover_file'), - url(r'^add_image/$', 'add_image', name='cover_add_image'), -) + url(r'^image/$', views.image_list, name='cover_image_list'), + url(r'^image/(?P\d+)/?$', views.image, name='cover_image'), + url(r'^image/(?P\d+)/file/', views.image_file, name='cover_file'), + url(r'^add_image/$', views.add_image, name='cover_add_image'), +] diff --git a/src/dvcs/storage.py b/src/dvcs/storage.py index 6bb5b595..91f78e60 100755 --- a/src/dvcs/storage.py +++ b/src/dvcs/storage.py @@ -2,8 +2,10 @@ from zlib import compress, decompress from django.core.files.base import ContentFile, File from django.core.files.storage import FileSystemStorage +from django.utils.deconstruct import deconstructible +@deconstructible class GzipFileSystemStorage(FileSystemStorage): def _open(self, name, mode='rb'): """TODO: This is good for reading; what about writing?""" diff --git a/src/dvcs/tests/__init__.py b/src/dvcs/tests/__init__.py old mode 100755 new mode 100644 index 868f00a3..e69de29b --- a/src/dvcs/tests/__init__.py +++ b/src/dvcs/tests/__init__.py @@ -1,178 +0,0 @@ -from nose.tools import * -from django.test import TestCase -from dvcs.models import Document - - -class ADocument(Document): - class Meta: - app_label = 'dvcs' - - -class DocumentModelTests(TestCase): - - def assertTextEqual(self, given, expected): - return self.assertEqual(given, expected, - "Expected '''%s'''\n differs from text: '''%s'''" % (expected, given) - ) - - def test_empty_file(self): - doc = ADocument.objects.create() - self.assertTextEqual(doc.materialize(), u"") - - def test_single_commit(self): - doc = ADocument.objects.create() - doc.commit(text=u"Ala ma kota", description="Commit #1") - self.assertTextEqual(doc.materialize(), u"Ala ma kota") - - def test_chained_commits(self): - doc = ADocument.objects.create() - text1 = u""" - Line #1 - Line #2 is cool - """ - text2 = u""" - Line #1 - Line #2 is hot - """ - text3 = u""" - Line #1 - ... is hot - Line #3 ate Line #2 - """ - - c1 = doc.commit(description="Commit #1", text=text1) - c2 = doc.commit(description="Commit #2", text=text2) - c3 = doc.commit(description="Commit #3", text=text3) - - self.assertTextEqual(doc.materialize(), text3) - self.assertTextEqual(doc.materialize(change=c3), text3) - self.assertTextEqual(doc.materialize(change=c2), text2) - self.assertTextEqual(doc.materialize(change=c1), text1) - - def test_parallel_commit_noconflict(self): - doc = ADocument.objects.create() - text1 = u""" - Line #1 - Line #2 - """ - text2 = u""" - Line #1 is hot - Line #2 - """ - text3 = u""" - Line #1 - Line #2 - Line #3 - """ - text_merged = u""" - Line #1 is hot - Line #2 - Line #3 - """ - - base = doc.commit(description="Commit #1", text=text1) - c1 = doc.commit(description="Commit #2", text=text2) - commits = doc.change_set.count() - c2 = doc.commit(description="Commit #3", text=text3, parent=base) - self.assertEqual(doc.change_set.count(), commits + 2, - u"Parallel commits should create an additional merge commit") - self.assertTextEqual(doc.materialize(), text_merged) - - def test_parallel_commit_conflict(self): - doc = ADocument.objects.create() - text1 = u""" - Line #1 - Line #2 - Line #3 - """ - text2 = u""" - Line #1 - Line #2 is hot - Line #3 - """ - text3 = u""" - Line #1 - Line #2 is cool - Line #3 - """ - text_merged = u""" - Line #1 -<<<<<<< - Line #2 is hot -======= - Line #2 is cool ->>>>>>> - Line #3 - """ - base = doc.commit(description="Commit #1", text=text1) - c1 = doc.commit(description="Commit #2", text=text2) - commits = doc.change_set.count() - c2 = doc.commit(description="Commit #3", text=text3, parent=base) - self.assertEqual(doc.change_set.count(), commits + 2, - u"Parallel commits should create an additional merge commit") - self.assertTextEqual(doc.materialize(), text_merged) - - - def test_multiple_parallel_commits(self): - text_a1 = u""" - Line #1 - - Line #2 - - Line #3 - """ - text_a2 = u""" - Line #1 * - - Line #2 - - Line #3 - """ - text_b1 = u""" - Line #1 - - Line #2 ** - - Line #3 - """ - text_c1 = u""" - Line #1 - - Line #2 - - Line #3 *** - """ - text_merged = u""" - Line #1 * - - Line #2 ** - - Line #3 *** - """ - - - doc = ADocument.objects.create() - c1 = doc.commit(description="Commit A1", text=text_a1) - c2 = doc.commit(description="Commit A2", text=text_a2, parent=c1) - c3 = doc.commit(description="Commit B1", text=text_b1, parent=c1) - c4 = doc.commit(description="Commit C1", text=text_c1, parent=c1) - self.assertTextEqual(doc.materialize(), text_merged) - - - def test_prepend_history(self): - doc1 = ADocument.objects.create() - doc2 = ADocument.objects.create() - doc1.commit(text='Commit 1') - doc2.commit(text='Commit 2') - doc2.prepend_history(doc1) - self.assertEqual(ADocument.objects.all().count(), 1) - self.assertTextEqual(doc2.at_revision(1).materialize(), 'Commit 1') - self.assertTextEqual(doc2.materialize(), 'Commit 2') - - def test_prepend_to_self(self): - doc = ADocument.objects.create() - doc.commit(text='Commit 1') - with self.assertRaises(AssertionError): - doc.prepend_history(doc) - self.assertTextEqual(doc.materialize(), 'Commit 1') - diff --git a/src/dvcs/tests/migrations/0001_initial.py b/src/dvcs/tests/migrations/0001_initial.py new file mode 100644 index 00000000..39176de8 --- /dev/null +++ b/src/dvcs/tests/migrations/0001_initial.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.13 on 2019-02-28 00:55 +from __future__ import unicode_literals + +import datetime +import os.path +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import dvcs.models +import dvcs.storage + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='ADocument', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('creator', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='created_adocument', to=settings.AUTH_USER_MODEL, verbose_name='creator')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='ADocumentChange', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('author_name', models.CharField(blank=True, help_text='Used if author is not set.', max_length=128, null=True, verbose_name='author name')), + ('author_email', models.CharField(blank=True, help_text='Used if author is not set.', max_length=128, null=True, verbose_name='author email')), + ('revision', models.IntegerField(db_index=True, verbose_name='revision')), + ('description', models.TextField(blank=True, default=b'', verbose_name='description')), + ('created_at', models.DateTimeField(db_index=True, default=datetime.datetime.now, editable=False)), + ('publishable', models.BooleanField(default=False, verbose_name='publishable')), + ('data', models.FileField(storage=dvcs.storage.GzipFileSystemStorage(location=os.path.join(settings.MEDIA_ROOT, 'dvcs')), upload_to=dvcs.models.data_upload_to, verbose_name='data')), + ('author', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='author')), + ('merge_parent', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='merge_children', to='tests.ADocumentChange', verbose_name='merge parent')), + ('parent', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='tests.ADocumentChange', verbose_name='parent')), + ], + options={ + 'ordering': ('created_at',), + 'abstract': False, + 'verbose_name': 'change for: a document', + 'verbose_name_plural': 'changes for: a document', + }, + ), + migrations.CreateModel( + name='ADocumentTag', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=64, verbose_name='name')), + ('slug', models.SlugField(blank=True, max_length=64, null=True, unique=True, verbose_name='slug')), + ('ordering', models.IntegerField(verbose_name='ordering')), + ], + options={ + 'ordering': ['ordering'], + 'abstract': False, + 'verbose_name': 'tag for: a document', + 'verbose_name_plural': 'tags for: a document', + }, + ), + migrations.AddField( + model_name='adocumentchange', + name='tags', + field=models.ManyToManyField(related_name='change_set', to='tests.ADocumentTag', verbose_name='tags'), + ), + migrations.AddField( + model_name='adocumentchange', + name='tree', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='change_set', to='tests.ADocument', verbose_name='document'), + ), + migrations.AddField( + model_name='adocument', + name='head', + field=models.ForeignKey(blank=True, default=None, editable=False, help_text="This document's current head.", null=True, on_delete=django.db.models.deletion.CASCADE, to='tests.ADocumentChange', verbose_name='head'), + ), + migrations.AddField( + model_name='adocument', + name='stage', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='tests.ADocumentTag', verbose_name='stage'), + ), + migrations.AddField( + model_name='adocument', + name='user', + field=models.ForeignKey(blank=True, help_text='Work assignment.', null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='user'), + ), + migrations.AlterUniqueTogether( + name='adocumentchange', + unique_together=set([('tree', 'revision')]), + ), + ] diff --git a/src/dvcs/tests/migrations/__init__.py b/src/dvcs/tests/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/dvcs/tests/models.py b/src/dvcs/tests/models.py new file mode 100644 index 00000000..61174c17 --- /dev/null +++ b/src/dvcs/tests/models.py @@ -0,0 +1,5 @@ +from dvcs.models import Document + + +class ADocument(Document): + pass diff --git a/src/dvcs/tests/tests.py b/src/dvcs/tests/tests.py new file mode 100644 index 00000000..5c7a4758 --- /dev/null +++ b/src/dvcs/tests/tests.py @@ -0,0 +1,173 @@ +from nose.tools import * +from django.test import TestCase +from .models import ADocument + + +class DocumentModelTests(TestCase): + + def assertTextEqual(self, given, expected): + return self.assertEqual(given, expected, + "Expected '''%s'''\n differs from text: '''%s'''" % (expected, given) + ) + + def test_empty_file(self): + doc = ADocument.objects.create() + self.assertTextEqual(doc.materialize(), u"") + + def test_single_commit(self): + doc = ADocument.objects.create() + doc.commit(text=u"Ala ma kota", description="Commit #1") + self.assertTextEqual(doc.materialize(), u"Ala ma kota") + + def test_chained_commits(self): + doc = ADocument.objects.create() + text1 = u""" + Line #1 + Line #2 is cool + """ + text2 = u""" + Line #1 + Line #2 is hot + """ + text3 = u""" + Line #1 + ... is hot + Line #3 ate Line #2 + """ + + c1 = doc.commit(description="Commit #1", text=text1) + c2 = doc.commit(description="Commit #2", text=text2) + c3 = doc.commit(description="Commit #3", text=text3) + + self.assertTextEqual(doc.materialize(), text3) + self.assertTextEqual(doc.materialize(change=c3), text3) + self.assertTextEqual(doc.materialize(change=c2), text2) + self.assertTextEqual(doc.materialize(change=c1), text1) + + def test_parallel_commit_noconflict(self): + doc = ADocument.objects.create() + text1 = u""" + Line #1 + Line #2 + """ + text2 = u""" + Line #1 is hot + Line #2 + """ + text3 = u""" + Line #1 + Line #2 + Line #3 + """ + text_merged = u""" + Line #1 is hot + Line #2 + Line #3 + """ + + base = doc.commit(description="Commit #1", text=text1) + c1 = doc.commit(description="Commit #2", text=text2) + commits = doc.change_set.count() + c2 = doc.commit(description="Commit #3", text=text3, parent=base) + self.assertEqual(doc.change_set.count(), commits + 2, + u"Parallel commits should create an additional merge commit") + self.assertTextEqual(doc.materialize(), text_merged) + + def test_parallel_commit_conflict(self): + doc = ADocument.objects.create() + text1 = u""" + Line #1 + Line #2 + Line #3 + """ + text2 = u""" + Line #1 + Line #2 is hot + Line #3 + """ + text3 = u""" + Line #1 + Line #2 is cool + Line #3 + """ + text_merged = u""" + Line #1 +<<<<<<< + Line #2 is hot +======= + Line #2 is cool +>>>>>>> + Line #3 + """ + base = doc.commit(description="Commit #1", text=text1) + c1 = doc.commit(description="Commit #2", text=text2) + commits = doc.change_set.count() + c2 = doc.commit(description="Commit #3", text=text3, parent=base) + self.assertEqual(doc.change_set.count(), commits + 2, + u"Parallel commits should create an additional merge commit") + self.assertTextEqual(doc.materialize(), text_merged) + + + def test_multiple_parallel_commits(self): + text_a1 = u""" + Line #1 + + Line #2 + + Line #3 + """ + text_a2 = u""" + Line #1 * + + Line #2 + + Line #3 + """ + text_b1 = u""" + Line #1 + + Line #2 ** + + Line #3 + """ + text_c1 = u""" + Line #1 + + Line #2 + + Line #3 *** + """ + text_merged = u""" + Line #1 * + + Line #2 ** + + Line #3 *** + """ + + + doc = ADocument.objects.create() + c1 = doc.commit(description="Commit A1", text=text_a1) + c2 = doc.commit(description="Commit A2", text=text_a2, parent=c1) + c3 = doc.commit(description="Commit B1", text=text_b1, parent=c1) + c4 = doc.commit(description="Commit C1", text=text_c1, parent=c1) + self.assertTextEqual(doc.materialize(), text_merged) + + + def test_prepend_history(self): + doc1 = ADocument.objects.create() + doc2 = ADocument.objects.create() + doc1.commit(text='Commit 1') + doc2.commit(text='Commit 2') + doc2.prepend_history(doc1) + self.assertEqual(ADocument.objects.all().count(), 1) + self.assertTextEqual(doc2.at_revision(1).materialize(), 'Commit 1') + self.assertTextEqual(doc2.materialize(), 'Commit 2') + + def test_prepend_to_self(self): + doc = ADocument.objects.create() + doc.commit(text='Commit 1') + with self.assertRaises(AssertionError): + doc.prepend_history(doc) + self.assertTextEqual(doc.materialize(), 'Commit 1') + diff --git a/src/fileupload/templatetags/upload_tags.py b/src/fileupload/templatetags/upload_tags.py index aefce2e3..4eb4251d 100644 --- a/src/fileupload/templatetags/upload_tags.py +++ b/src/fileupload/templatetags/upload_tags.py @@ -1,10 +1,11 @@ from django import template +from django.utils.safestring import mark_safe register = template.Library() @register.simple_tag def upload_js(): - return """ + return mark_safe(""" -""" +""") diff --git a/src/redakcja/settings/common.py b/src/redakcja/settings/common.py index 6c53d446..fd870ab8 100644 --- a/src/redakcja/settings/common.py +++ b/src/redakcja/settings/common.py @@ -5,7 +5,6 @@ import os.path PROJECT_ROOT = os.path.realpath(os.path.dirname(os.path.dirname(__file__))) DEBUG = False -TEMPLATE_DEBUG = DEBUG MAINTENANCE_MODE = False @@ -54,21 +53,25 @@ STATIC_URL = '/media/static/' SESSION_COOKIE_NAME = "redakcja_sessionid" -# List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', -) - -TEMPLATE_CONTEXT_PROCESSORS = ( - "django.contrib.auth.context_processors.auth", - "django.core.context_processors.debug", - "django.core.context_processors.i18n", - "redakcja.context_processors.settings", # this is instead of media - 'django.core.context_processors.csrf', - "django.core.context_processors.request", -) - +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'APP_DIRS': True, + 'DIRS': [ + PROJECT_ROOT + '/templates', + ], + 'OPTIONS': { + 'context_processors': [ + "django.contrib.auth.context_processors.auth", + "django.template.context_processors.debug", + "django.template.context_processors.i18n", + "redakcja.context_processors.settings", # this is instead of media + 'django.template.context_processors.csrf', + "django.template.context_processors.request", + ], + }, + }, +] MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', @@ -80,7 +83,7 @@ MIDDLEWARE_CLASSES = ( 'django_cas.middleware.CASMiddleware', 'django.contrib.admindocs.middleware.XViewMiddleware', - 'pagination.middleware.PaginationMiddleware', + 'fnp_django_pagination.middleware.PaginationMiddleware', 'maintenancemode.middleware.MaintenanceModeMiddleware', ) @@ -91,10 +94,6 @@ AUTHENTICATION_BACKENDS = ( ROOT_URLCONF = 'redakcja.urls' -TEMPLATE_DIRS = ( - PROJECT_ROOT + '/templates', -) - FIREPYTHON_LOGGER_NAME = "fnp" INSTALLED_APPS = ( @@ -106,12 +105,10 @@ INSTALLED_APPS = ( 'django.contrib.sites', 'django.contrib.admin', 'django.contrib.admindocs', - 'django.contrib.comments', 'raven.contrib.django.raven_compat', - 'south', 'sorl.thumbnail', - 'pagination', + 'fnp_django_pagination', 'django_gravatar', 'fileupload', 'kombu.transport.django', @@ -133,8 +130,6 @@ LOGIN_REDIRECT_URL = '/documents/user' CAS_USER_ATTRS_MAP = { 'email': 'email', 'firstname': 'first_name', 'lastname': 'last_name'} -# REPOSITORY_PATH = '/Users/zuber/Projekty/platforma/files/books' - IMAGE_DIR = 'images/' diff --git a/src/redakcja/settings/compress.py b/src/redakcja/settings/compress.py index 9bee6706..0406fdf8 100644 --- a/src/redakcja/settings/compress.py +++ b/src/redakcja/settings/compress.py @@ -7,52 +7,52 @@ STATICFILES_FINDERS = ( STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage' -PIPELINE_CSS_COMPRESSOR = None -PIPELINE_JS_COMPRESSOR = None -PIPELINE_STORAGE = 'pipeline.storage.PipelineFinderStorage' +PIPELINE = { + 'CSS_COMPRESSOR': None, + 'JS_COMPRESSOR': None, + #'PIPELINE_STORAGE = 'pipeline.storage.PipelineFinderStorage' -# CSS and JS files to compress -PIPELINE_CSS = { - 'detail': { - 'source_filenames': ( - 'css/master.css', - 'css/toolbar.css', - 'css/gallery.css', - 'css/history.css', - 'css/summary.css', - 'css/html.css', - 'css/jquery.autocomplete.css', - 'css/imgareaselect-default.css', #img! - 'css/dialogs.css', - ), - 'output_filename': 'compressed/detail_styles.css', - }, - 'catalogue': { - 'source_filenames': ( - 'css/filelist.css', - ), - 'output_filename': 'compressed/catalogue_styles.css', - }, - 'book': { - 'source_filenames': ( - 'css/book.css', - ), - 'output_filename': 'compressed/book.css', - }, - 'book_list': { - 'source_filenames': ( - 'contextmenu/jquery.contextMenu.css', - 'css/book_list.css', - ), - 'output_filename': 'compressed/book_list.css', + # CSS and JS files to compress + 'STYLESHEETS': { + 'detail': { + 'source_filenames': ( + 'css/master.css', + 'css/toolbar.css', + 'css/gallery.css', + 'css/history.css', + 'css/summary.css', + 'css/html.css', + 'css/jquery.autocomplete.css', + 'css/imgareaselect-default.css', #img! + 'css/dialogs.css', + ), + 'output_filename': 'compressed/detail_styles.css', + }, + 'catalogue': { + 'source_filenames': ( + 'css/filelist.css', + ), + 'output_filename': 'compressed/catalogue_styles.css', + }, + 'book': { + 'source_filenames': ( + 'css/book.css', + ), + 'output_filename': 'compressed/book.css', + }, + 'book_list': { + 'source_filenames': ( + 'contextmenu/jquery.contextMenu.css', + 'css/book_list.css', + ), + 'output_filename': 'compressed/book_list.css', + }, }, -} - -PIPELINE_JS = { - # everything except codemirror - 'detail': { - 'source_filenames': ( + 'JAVASCRIPT': { + # everything except codemirror + 'detail': { + 'source_filenames': ( # libraries 'js/lib/jquery/jquery.autocomplete.js', 'js/lib/jquery/jquery.blockui.js', @@ -83,11 +83,11 @@ PIPELINE_JS = { 'js/wiki/view_annotations.js', 'js/wiki/view_search.js', 'js/wiki/view_column_diff.js', - ), - 'output_filename': 'compressed/detail_scripts.js', - }, - 'wiki_img': { - 'source_filenames': ( + ), + 'output_filename': 'compressed/detail_scripts.js', + }, + 'wiki_img': { + 'source_filenames': ( # libraries 'js/lib/jquery-1.4.2.min.js', 'js/lib/jquery/jquery.autocomplete.js', @@ -115,32 +115,33 @@ PIPELINE_JS = { 'js/wiki/view_editor_source.js', 'js/wiki/view_history.js', 'js/wiki/view_column_diff.js', - ), - 'output_filename': 'compressed/detail_img_scripts.js', - }, - 'catalogue': { - 'source_filenames': ( + ), + 'output_filename': 'compressed/detail_img_scripts.js', + }, + 'catalogue': { + 'source_filenames': ( 'js/catalogue/catalogue.js', 'js/slugify.js', 'email_mangler/email_mangler.js', - ), - 'output_filename': 'compressed/catalogue_scripts.js', - }, - 'book': { - 'source_filenames': ( - 'js/book_text/jquery.eventdelegation.js', - 'js/book_text/jquery.scrollto.js', - 'js/book_text/jquery.highlightfade.js', - 'js/book_text/book.js', - ), - 'output_filename': 'compressed/book.js', + ), + 'output_filename': 'compressed/catalogue_scripts.js', }, - 'book_list': { - 'source_filenames': ( - 'contextmenu/jquery.ui.position.js', - 'contextmenu/jquery.contextMenu.js', - 'js/catalogue/book_list.js', - ), - 'output_filename': 'compressed/book_list.js', + 'book': { + 'source_filenames': ( + 'js/book_text/jquery.eventdelegation.js', + 'js/book_text/jquery.scrollto.js', + 'js/book_text/jquery.highlightfade.js', + 'js/book_text/book.js', + ), + 'output_filename': 'compressed/book.js', + }, + 'book_list': { + 'source_filenames': ( + 'contextmenu/jquery.ui.position.js', + 'contextmenu/jquery.contextMenu.js', + 'js/catalogue/book_list.js', + ), + 'output_filename': 'compressed/book_list.js', + } } } diff --git a/src/redakcja/settings/test.py b/src/redakcja/settings/test.py index cd131787..907fbc77 100644 --- a/src/redakcja/settings/test.py +++ b/src/redakcja/settings/test.py @@ -24,19 +24,7 @@ CATALOGUE_IMAGE_REPO_PATH = tempfile.mkdtemp(prefix='redakcja-repo-img') MEDIA_ROOT = tempfile.mkdtemp(prefix='media-root') CELERY_ALWAYS_EAGER = True -INSTALLED_APPS += ('django_nose', 'dvcs.tests') - -TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' -TEST_MODULES = ('catalogue', 'cover', 'dvcs.tests', 'wiki', 'toolbar') -COVER_APPS = ('catalogue', 'cover', 'dvcs', 'wiki', 'toolbar') -NOSE_ARGS = ( - '--tests=' + ','.join(TEST_MODULES), - '--cover-package=' + ','.join(COVER_APPS), - '-d', - '--with-doctest', - '--with-xunit', - '--with-xcoverage', -) +INSTALLED_APPS += ('dvcs.tests',) SECRET_KEY = "not-so-secret" diff --git a/src/redakcja/urls.py b/src/redakcja/urls.py index c0629fac..2fb2d39d 100644 --- a/src/redakcja/urls.py +++ b/src/redakcja/urls.py @@ -1,35 +1,34 @@ # -*- coding: utf-8 -*- -from django.conf.urls import include, patterns, url +from django.conf.urls import include, url from django.contrib import admin from django.conf import settings from django.conf.urls.static import static from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.views.generic import RedirectView +import django_cas.views admin.autodiscover() -urlpatterns = patterns('', +urlpatterns = [ # Auth - url(r'^accounts/login/$', 'django_cas.views.login', name='login'), - url(r'^accounts/logout/$', 'django_cas.views.logout', name='logout'), - url(r'^admin/login/$', 'django_cas.views.login', name='login'), - url(r'^admin/logout/$', 'django_cas.views.logout', name='logout'), + url(r'^accounts/login/$', django_cas.views.login, name='login'), + url(r'^accounts/logout/$', django_cas.views.logout, name='logout'), + url(r'^admin/login/$', django_cas.views.login, name='login'), + url(r'^admin/logout/$', django_cas.views.logout, name='logout'), # Admin panel url(r'^admin/doc/', include('django.contrib.admindocs.urls')), - (r'^admin/', include(admin.site.urls)), + url(r'^admin/', include(admin.site.urls)), - (r'^comments/', include('django.contrib.comments.urls')), - - url(r'^$', RedirectView.as_view(url= '/documents/')), + url(r'^$', RedirectView.as_view(url= '/documents/', permanent=False)), url(r'^documents/', include('catalogue.urls')), url(r'^apiclient/', include('apiclient.urls')), url(r'^editor/', include('wiki.urls')), url(r'^images/', include('wiki_img.urls')), url(r'^cover/', include('cover.urls')), -) +] if settings.DEBUG: urlpatterns += staticfiles_urlpatterns() diff --git a/src/toolbar/migrations/0001_initial.py b/src/toolbar/migrations/0001_initial.py index 5a6f27c6..e3a24044 100644 --- a/src/toolbar/migrations/0001_initial.py +++ b/src/toolbar/migrations/0001_initial.py @@ -1,93 +1,68 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models +# -*- coding: utf-8 -*- +from __future__ import unicode_literals -class Migration(SchemaMigration): +from django.db import models, migrations - def forwards(self, orm): - # Adding model 'ButtonGroup' - db.create_table('toolbar_buttongroup', ( - ('position', self.gf('django.db.models.fields.IntegerField')(default=0)), - ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)), - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=32)), - )) - db.send_create_signal('toolbar', ['ButtonGroup']) +class Migration(migrations.Migration): - # Adding model 'Button' - db.create_table('toolbar_button', ( - ('key_mod', self.gf('django.db.models.fields.PositiveIntegerField')(default=1, blank=True)), - ('scriptlet', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['toolbar.Scriptlet'], null=True, blank=True)), - ('tooltip', self.gf('django.db.models.fields.CharField')(max_length=120, blank=True)), - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('link', self.gf('django.db.models.fields.CharField')(default='', max_length=256, blank=True)), - ('key', self.gf('django.db.models.fields.CharField')(max_length=1, blank=True)), - ('params', self.gf('django.db.models.fields.TextField')(default='[]')), - ('label', self.gf('django.db.models.fields.CharField')(max_length=32)), - ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50, db_index=True)), - )) - db.send_create_signal('toolbar', ['Button']) + dependencies = [ + ] - # Adding M2M table for field group on 'Button' - db.create_table('toolbar_button_group', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('button', models.ForeignKey(orm['toolbar.button'], null=False)), - ('buttongroup', models.ForeignKey(orm['toolbar.buttongroup'], null=False)) - )) - db.create_unique('toolbar_button_group', ['button_id', 'buttongroup_id']) - - # Adding model 'Scriptlet' - db.create_table('toolbar_scriptlet', ( - ('code', self.gf('django.db.models.fields.TextField')()), - ('name', self.gf('django.db.models.fields.CharField')(max_length=64, primary_key=True)), - )) - db.send_create_signal('toolbar', ['Scriptlet']) - - - def backwards(self, orm): - - # Deleting model 'ButtonGroup' - db.delete_table('toolbar_buttongroup') - - # Deleting model 'Button' - db.delete_table('toolbar_button') - - # Removing M2M table for field group on 'Button' - db.delete_table('toolbar_button_group') - - # Deleting model 'Scriptlet' - db.delete_table('toolbar_scriptlet') - - - models = { - 'toolbar.button': { - 'Meta': {'object_name': 'Button'}, - 'group': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['toolbar.ButtonGroup']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'key': ('django.db.models.fields.CharField', [], {'max_length': '1', 'blank': 'True'}), - 'key_mod': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'blank': 'True'}), - 'label': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'link': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), - 'params': ('django.db.models.fields.TextField', [], {'default': "'[]'"}), - 'scriptlet': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['toolbar.Scriptlet']", 'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}), - 'tooltip': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}) - }, - 'toolbar.buttongroup': { - 'Meta': {'object_name': 'ButtonGroup'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'position': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}) - }, - 'toolbar.scriptlet': { - 'Meta': {'object_name': 'Scriptlet'}, - 'code': ('django.db.models.fields.TextField', [], {}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64', 'primary_key': 'True'}) - } - } - - complete_apps = ['toolbar'] + operations = [ + migrations.CreateModel( + name='Button', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('label', models.CharField(max_length=32)), + ('slug', models.SlugField(unique=True)), + ('params', models.TextField(default=b'[]')), + ('link', models.CharField(default=b'', max_length=256, blank=True)), + ('accesskey', models.CharField(max_length=1, blank=True)), + ('tooltip', models.CharField(max_length=120, blank=True)), + ], + options={ + 'ordering': ('slug',), + 'verbose_name': 'button', + 'verbose_name_plural': 'buttons', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='ButtonGroup', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=32)), + ('slug', models.SlugField()), + ('position', models.IntegerField(default=0)), + ], + options={ + 'ordering': ('position', 'name'), + 'verbose_name': 'button group', + 'verbose_name_plural': 'button groups', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Scriptlet', + fields=[ + ('name', models.CharField(max_length=64, serialize=False, primary_key=True)), + ('code', models.TextField()), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.AddField( + model_name='button', + name='group', + field=models.ManyToManyField(to='toolbar.ButtonGroup'), + preserve_default=True, + ), + migrations.AddField( + model_name='button', + name='scriptlet', + field=models.ForeignKey(blank=True, to='toolbar.Scriptlet', null=True), + preserve_default=True, + ), + ] diff --git a/src/toolbar/migrations/0002_auto__del_field_button_key_mod__chg_field_button_key.py b/src/toolbar/migrations/0002_auto__del_field_button_key_mod__chg_field_button_key.py deleted file mode 100644 index af58c6ec..00000000 --- a/src/toolbar/migrations/0002_auto__del_field_button_key_mod__chg_field_button_key.py +++ /dev/null @@ -1,52 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Deleting field 'Button.key_mod' - db.delete_column('toolbar_button', 'key_mod') - - # Changing field 'Button.key' - db.alter_column('toolbar_button', 'key', self.gf('django.db.models.fields.CharField')(max_length=1, null=True)) - - def backwards(self, orm): - - # Adding field 'Button.key_mod' - db.add_column('toolbar_button', 'key_mod', self.gf('django.db.models.fields.PositiveIntegerField')(default=1, blank=True), keep_default=False) - - # Changing field 'Button.key' - db.alter_column('toolbar_button', 'key', self.gf('django.db.models.fields.CharField')(max_length=1, blank=True)) - - models = { - 'toolbar.button': { - 'Meta': {'object_name': 'Button'}, - 'group': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['toolbar.ButtonGroup']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'key': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True'}), - 'label': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'link': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), - 'params': ('django.db.models.fields.TextField', [], {'default': "'[]'"}), - 'scriptlet': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['toolbar.Scriptlet']", 'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}), - 'tooltip': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}) - }, - 'toolbar.buttongroup': { - 'Meta': {'object_name': 'ButtonGroup'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'position': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}) - }, - 'toolbar.scriptlet': { - 'Meta': {'object_name': 'Scriptlet'}, - 'code': ('django.db.models.fields.TextField', [], {}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64', 'primary_key': 'True'}) - } - } - - complete_apps = ['toolbar'] diff --git a/src/toolbar/migrations/0003_button_key_rename_to_accesskey.py b/src/toolbar/migrations/0003_button_key_rename_to_accesskey.py deleted file mode 100644 index 7a0961d9..00000000 --- a/src/toolbar/migrations/0003_button_key_rename_to_accesskey.py +++ /dev/null @@ -1,47 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Deleting field 'Button.key' - db.rename_column('toolbar_button', 'key', 'accesskey') - - - - def backwards(self, orm): - db.rename_column('toolbar_button', 'accesskey', 'key') - - - models = { - 'toolbar.button': { - 'Meta': {'object_name': 'Button'}, - 'accesskey': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True'}), - 'group': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['toolbar.ButtonGroup']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'label': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'link': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), - 'params': ('django.db.models.fields.TextField', [], {'default': "'[]'"}), - 'scriptlet': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['toolbar.Scriptlet']", 'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}), - 'tooltip': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}) - }, - 'toolbar.buttongroup': { - 'Meta': {'object_name': 'ButtonGroup'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'position': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}) - }, - 'toolbar.scriptlet': { - 'Meta': {'object_name': 'Scriptlet'}, - 'code': ('django.db.models.fields.TextField', [], {}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64', 'primary_key': 'True'}) - } - } - - complete_apps = ['toolbar'] diff --git a/src/toolbar/migrations/0004_auto__chg_field_button_accesskey.py b/src/toolbar/migrations/0004_auto__chg_field_button_accesskey.py deleted file mode 100644 index 5f28bf55..00000000 --- a/src/toolbar/migrations/0004_auto__chg_field_button_accesskey.py +++ /dev/null @@ -1,48 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'Button.accesskey' - db.alter_column('toolbar_button', 'accesskey', self.gf('django.db.models.fields.CharField')(max_length=1)) - - - def backwards(self, orm): - - # Changing field 'Button.accesskey' - db.alter_column('toolbar_button', 'accesskey', self.gf('django.db.models.fields.CharField')(max_length=1, null=True)) - - - models = { - 'toolbar.button': { - 'Meta': {'ordering': "('slug',)", 'object_name': 'Button'}, - 'accesskey': ('django.db.models.fields.CharField', [], {'max_length': '1', 'blank': 'True'}), - 'group': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['toolbar.ButtonGroup']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'label': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'link': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), - 'params': ('django.db.models.fields.TextField', [], {'default': "'[]'"}), - 'scriptlet': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['toolbar.Scriptlet']", 'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}), - 'tooltip': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}) - }, - 'toolbar.buttongroup': { - 'Meta': {'ordering': "('position', 'name')", 'object_name': 'ButtonGroup'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'position': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}) - }, - 'toolbar.scriptlet': { - 'Meta': {'object_name': 'Scriptlet'}, - 'code': ('django.db.models.fields.TextField', [], {}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64', 'primary_key': 'True'}) - } - } - - complete_apps = ['toolbar'] diff --git a/src/toolbar/migrations/0005_initial_data.py b/src/toolbar/migrations/0005_initial_data.py deleted file mode 100644 index b31f3809..00000000 --- a/src/toolbar/migrations/0005_initial_data.py +++ /dev/null @@ -1,46 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import DataMigration -from django.db import models - -class Migration(DataMigration): - - def forwards(self, orm): - from django.core.management import call_command - call_command("loaddata", "initial_toolbar.yaml") - - - def backwards(self, orm): - "Write your backwards methods here." - pass - - - models = { - 'toolbar.button': { - 'Meta': {'ordering': "('slug',)", 'object_name': 'Button'}, - 'accesskey': ('django.db.models.fields.CharField', [], {'max_length': '1', 'blank': 'True'}), - 'group': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['toolbar.ButtonGroup']", 'symmetrical': 'False'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'label': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'link': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), - 'params': ('django.db.models.fields.TextField', [], {'default': "'[]'"}), - 'scriptlet': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['toolbar.Scriptlet']", 'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}), - 'tooltip': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}) - }, - 'toolbar.buttongroup': { - 'Meta': {'ordering': "('position', 'name')", 'object_name': 'ButtonGroup'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'position': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}) - }, - 'toolbar.scriptlet': { - 'Meta': {'object_name': 'Scriptlet'}, - 'code': ('django.db.models.fields.TextField', [], {}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '64', 'primary_key': 'True'}) - } - } - - complete_apps = ['toolbar'] diff --git a/src/wiki/migrations/0001_initial.py b/src/wiki/migrations/0001_initial.py index 4acf5ba5..79c8e993 100644 --- a/src/wiki/migrations/0001_initial.py +++ b/src/wiki/migrations/0001_initial.py @@ -1,21 +1,26 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models +# -*- coding: utf-8 -*- +from __future__ import unicode_literals -class Migration(SchemaMigration): - - def forwards(self, orm): - pass - - - def backwards(self, orm): - pass - - - models = { - - } - - complete_apps = ['wiki'] +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Theme', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(unique=True, max_length=50, verbose_name='name')), + ], + options={ + 'ordering': ('name',), + 'verbose_name': 'theme', + 'verbose_name_plural': 'themes', + }, + bases=(models.Model,), + ), + ] diff --git a/src/wiki/migrations/0002_auto__add_theme.py b/src/wiki/migrations/0002_auto__add_theme.py deleted file mode 100644 index 6688139d..00000000 --- a/src/wiki/migrations/0002_auto__add_theme.py +++ /dev/null @@ -1,38 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding model 'Theme' - db.create_table('wiki_theme', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=50)), - )) - db.send_create_signal('wiki', ['Theme']) - - if not db.dry_run: - from django.core.management import call_command - call_command("loaddata", "initial_themes.yaml") - - - - def backwards(self, orm): - - # Deleting model 'Theme' - db.delete_table('wiki_theme') - - - models = { - 'wiki.theme': { - 'Meta': {'object_name': 'Theme'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50'}) - } - } - - complete_apps = ['wiki'] diff --git a/src/wiki/templates/wiki/document_details.html b/src/wiki/templates/wiki/document_details.html index 2211c0a3..4cc1e004 100644 --- a/src/wiki/templates/wiki/document_details.html +++ b/src/wiki/templates/wiki/document_details.html @@ -43,7 +43,6 @@ {% block dialogs %} {% include "wiki/save_dialog.html" %} {% include "wiki/revert_dialog.html" %} - {% include "wiki/tag_dialog.html" %} {% if can_pubmark %} {% include "wiki/pubmark_dialog.html" %} {% endif %} diff --git a/src/wiki/urls.py b/src/wiki/urls.py index 0c73aed9..eb70ffe6 100644 --- a/src/wiki/urls.py +++ b/src/wiki/urls.py @@ -1,31 +1,32 @@ # -*- coding: utf-8 -from django.conf.urls import patterns, url +from django.conf.urls import url +from . import views -urlpatterns = patterns('wiki.views', +urlpatterns = [ url(r'^edit/(?P[^/]+)/(?:(?P[^/]+)/)?$', - 'editor', name="wiki_editor"), + views.editor, name="wiki_editor"), url(r'^readonly/(?P[^/]+)/(?:(?P[^/]+)/)?$', - 'editor_readonly', name="wiki_editor_readonly"), + views.editor_readonly, name="wiki_editor_readonly"), url(r'^gallery/(?P[^/]+)/$', - 'gallery', name="wiki_gallery"), + views.gallery, name="wiki_gallery"), url(r'^history/(?P\d+)/$', - 'history', name="wiki_history"), + views.history, name="wiki_history"), url(r'^rev/(?P\d+)/$', - 'revision', name="wiki_revision"), + views.revision, name="wiki_revision"), url(r'^text/(?P\d+)/$', - 'text', name="wiki_text"), + views.text, name="wiki_text"), url(r'^revert/(?P\d+)/$', - 'revert', name='wiki_revert'), + views.revert, name='wiki_revert'), - url(r'^diff/(?P\d+)/$', 'diff', name="wiki_diff"), - url(r'^pubmark/(?P\d+)/$', 'pubmark', name="wiki_pubmark"), + url(r'^diff/(?P\d+)/$', views.diff, name="wiki_diff"), + url(r'^pubmark/(?P\d+)/$', views.pubmark, name="wiki_pubmark"), - url(r'^themes$', 'themes', name="themes"), -) + url(r'^themes$', views.themes, name="themes"), +] diff --git a/src/wiki_img/urls.py b/src/wiki_img/urls.py index 6a516f36..1bf14b8e 100644 --- a/src/wiki_img/urls.py +++ b/src/wiki_img/urls.py @@ -1,24 +1,24 @@ # -*- coding: utf-8 -from django.conf.urls import patterns, url +from django.conf.urls import url +from . import views -urlpatterns = patterns('wiki_img.views', +urlpatterns = [ url(r'^edit/(?P[^/]+)/$', - 'editor', name="wiki_img_editor"), + views.editor, name="wiki_img_editor"), url(r'^readonly/(?P[^/]+)/$', - 'editor_readonly', name="wiki_img_editor_readonly"), + views.editor_readonly, name="wiki_img_editor_readonly"), url(r'^text/(?P\d+)/$', - 'text', name="wiki_img_text"), + views.text, name="wiki_img_text"), url(r'^history/(?P\d+)/$', - 'history', name="wiki_img_history"), + views.history, name="wiki_img_history"), url(r'^revert/(?P\d+)/$', - 'revert', name='wiki_img_revert'), + views.revert, name='wiki_img_revert'), - url(r'^diff/(?P\d+)/$', 'diff', name="wiki_img_diff"), - url(r'^pubmark/(?P\d+)/$', 'pubmark', name="wiki_img_pubmark"), - -) + url(r'^diff/(?P\d+)/$', views.diff, name="wiki_img_diff"), + url(r'^pubmark/(?P\d+)/$', views.pubmark, name="wiki_img_pubmark"), +]