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
celery>=3.1.12,<3.2
kombu>=3.0,<3.1
-# migrations
-South>=1.0.2
-
raven
-# 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,),
+ ),
+ ]
+++ /dev/null
-# -*- 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
+++ /dev/null
-# -*- 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
# -*- 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'),
+]
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."""
-# 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',),
+ ),
+ ]
+++ /dev/null
-# 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']
+++ /dev/null
-# 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*<!--\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']
+++ /dev/null
-# 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']
+++ /dev/null
-# 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']
+++ /dev/null
-# 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']
+++ /dev/null
-# 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']
+++ /dev/null
-# 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']
+++ /dev/null
-# 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']
+++ /dev/null
-# -*- 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
+++ /dev/null
-# -*- 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
+++ /dev/null
-# -*- 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
+++ /dev/null
-# -*- 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
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):
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 _
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:
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:
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))
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))
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.
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)
published_wall(day=day),
image_changes_wall(day=day),
image_published_wall(day=day),
- comments_wall(day=day),
])}
-# -*- 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 *
+++ /dev/null
-# -*- 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!')
+++ /dev/null
-# -*- 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',
- ])
-
+++ /dev/null
-# -*- 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)
--- /dev/null
+# -*- 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!')
--- /dev/null
+# -*- 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',
+ ])
+
--- /dev/null
+# -*- 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)
--- /dev/null
+# -*- 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"
+ )
+++ /dev/null
-# -*- 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"
- )
# -*- 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<slug>[^/]+)/$', 'image', name="catalogue_image"),
- url(r'^image/(?P<slug>[^/]+)/publish$', 'publish_image',
+ url(r'^images/$', views.image_list, name='catalogue_image_list'),
+ url(r'^image/(?P<slug>[^/]+)/$', views.image, name="catalogue_image"),
+ url(r'^image/(?P<slug>[^/]+)/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<username>[^/]+)/$', '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<username>[^/]+)/$', 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<isodate>\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<slug>[^/]*)/',
- '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<slug>[^/]+)/publish$', 'publish', name="catalogue_publish"),
+ url(r'^book/(?P<slug>[^/]+)/publish$', views.publish, name="catalogue_publish"),
- url(r'^book/(?P<slug>[^/]+)/$', 'book', name="catalogue_book"),
+ url(r'^book/(?P<slug>[^/]+)/$', views.book, name="catalogue_book"),
url(r'^book/(?P<slug>[^/]+)/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<slug>[^/]+)/xml$', 'book_xml', name="catalogue_book_xml"),
- url(r'^book/dc/(?P<slug>[^/]+)/xml$', 'book_xml_dc', name="catalogue_book_xml_dc"),
- url(r'^book/(?P<slug>[^/]+)/txt$', 'book_txt', name="catalogue_book_txt"),
- url(r'^book/(?P<slug>[^/]+)/html$', 'book_html', name="catalogue_book_html"),
- url(r'^book/(?P<slug>[^/]+)/epub$', 'book_epub', name="catalogue_book_epub"),
- url(r'^book/(?P<slug>[^/]+)/mobi$', 'book_mobi', name="catalogue_book_mobi"),
- url(r'^book/(?P<slug>[^/]+)/pdf$', 'book_pdf', name="catalogue_book_pdf"),
- url(r'^book/(?P<slug>[^/]+)/pdf-mobile$', 'book_pdf', kwargs={'mobile': True}, name="catalogue_book_pdf_mobile"),
+ url(r'^book/(?P<slug>[^/]+)/xml$', views.book_xml, name="catalogue_book_xml"),
+ url(r'^book/dc/(?P<slug>[^/]+)/xml$', views.book_xml_dc, name="catalogue_book_xml_dc"),
+ url(r'^book/(?P<slug>[^/]+)/txt$', views.book_txt, name="catalogue_book_txt"),
+ url(r'^book/(?P<slug>[^/]+)/html$', views.book_html, name="catalogue_book_html"),
+ url(r'^book/(?P<slug>[^/]+)/epub$', views.book_epub, name="catalogue_book_epub"),
+ url(r'^book/(?P<slug>[^/]+)/mobi$', views.book_mobi, name="catalogue_book_mobi"),
+ url(r'^book/(?P<slug>[^/]+)/pdf$', views.book_pdf, name="catalogue_book_pdf"),
+ url(r'^book/(?P<slug>[^/]+)/pdf-mobile$', views.book_pdf, kwargs={'mobile': True}, name="catalogue_book_pdf_mobile"),
url(r'^chunk_add/(?P<slug>[^/]+)/(?P<chunk>[^/]+)/$',
- 'chunk_add', name="catalogue_chunk_add"),
+ views.chunk_add, name="catalogue_chunk_add"),
url(r'^chunk_edit/(?P<slug>[^/]+)/(?P<chunk>[^/]+)/$',
- 'chunk_edit', name="catalogue_chunk_edit"),
+ views.chunk_edit, name="catalogue_chunk_edit"),
url(r'^book_append/(?P<slug>[^/]+)/$',
- '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<slug>[^/]*)/$', 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'),
+]
class ImageAddForm(forms.ModelForm):
class Meta:
model = Image
+ exclude = []
def __init__(self, *args, **kwargs):
super(ImageAddForm, self).__init__(*args, **kwargs)
# -*- 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,),
+ ),
+ ]
+++ /dev/null
-# -*- 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
+++ /dev/null
-# -*- 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
# 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<book>[^/]+)/$', 'preview', name='cover_preview'),
+urlpatterns = [
+ url(r'^preview/$', views.preview_from_xml, name='cover_preview'),
+ url(r'^preview/(?P<book>[^/]+)/$', views.preview, name='cover_preview'),
url(r'^preview/(?P<book>[^/]+)/(?P<chunk>[^/]+)/$',
- 'preview', name='cover_preview'),
+ views.preview, name='cover_preview'),
url(r'^preview/(?P<book>[^/]+)/(?P<chunk>[^/]+)/(?P<rev>\d+)/$',
- 'preview', name='cover_preview'),
+ views.preview, name='cover_preview'),
- url(r'^image/$', 'image_list', name='cover_image_list'),
- url(r'^image/(?P<pk>\d+)/?$', 'image', name='cover_image'),
- url(r'^image/(?P<pk>\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<pk>\d+)/?$', views.image, name='cover_image'),
+ url(r'^image/(?P<pk>\d+)/file/', views.image_file, name='cover_file'),
+ url(r'^add_image/$', views.add_image, name='cover_add_image'),
+]
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?"""
-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')
-
--- /dev/null
+# -*- 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')]),
+ ),
+ ]
--- /dev/null
+from dvcs.models import Document
+
+
+class ADocument(Document):
+ pass
--- /dev/null
+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')
+
from django import template
+from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag
def upload_js():
- return """
+ return mark_safe("""
<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
</tr>
{% } %}
</script>
-"""
+""")
PROJECT_ROOT = os.path.realpath(os.path.dirname(os.path.dirname(__file__)))
DEBUG = False
-TEMPLATE_DEBUG = DEBUG
MAINTENANCE_MODE = False
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',
'django_cas.middleware.CASMiddleware',
'django.contrib.admindocs.middleware.XViewMiddleware',
- 'pagination.middleware.PaginationMiddleware',
+ 'fnp_django_pagination.middleware.PaginationMiddleware',
'maintenancemode.middleware.MaintenanceModeMiddleware',
)
ROOT_URLCONF = 'redakcja.urls'
-TEMPLATE_DIRS = (
- PROJECT_ROOT + '/templates',
-)
-
FIREPYTHON_LOGGER_NAME = "fnp"
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',
CAS_USER_ATTRS_MAP = {
'email': 'email', 'firstname': 'first_name', 'lastname': 'last_name'}
-# REPOSITORY_PATH = '/Users/zuber/Projekty/platforma/files/books'
-
IMAGE_DIR = 'images/'
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',
'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',
'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',
+ }
}
}
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"
# -*- 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()
-# 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,
+ ),
+ ]
+++ /dev/null
-# 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']
+++ /dev/null
-# 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']
+++ /dev/null
-# 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']
+++ /dev/null
-# 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']
-# 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,),
+ ),
+ ]
+++ /dev/null
-# 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']
{% 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 %}
# -*- 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<slug>[^/]+)/(?:(?P<chunk>[^/]+)/)?$',
- 'editor', name="wiki_editor"),
+ views.editor, name="wiki_editor"),
url(r'^readonly/(?P<slug>[^/]+)/(?:(?P<chunk>[^/]+)/)?$',
- 'editor_readonly', name="wiki_editor_readonly"),
+ views.editor_readonly, name="wiki_editor_readonly"),
url(r'^gallery/(?P<directory>[^/]+)/$',
- 'gallery', name="wiki_gallery"),
+ views.gallery, name="wiki_gallery"),
url(r'^history/(?P<chunk_id>\d+)/$',
- 'history', name="wiki_history"),
+ views.history, name="wiki_history"),
url(r'^rev/(?P<chunk_id>\d+)/$',
- 'revision', name="wiki_revision"),
+ views.revision, name="wiki_revision"),
url(r'^text/(?P<chunk_id>\d+)/$',
- 'text', name="wiki_text"),
+ views.text, name="wiki_text"),
url(r'^revert/(?P<chunk_id>\d+)/$',
- 'revert', name='wiki_revert'),
+ views.revert, name='wiki_revert'),
- url(r'^diff/(?P<chunk_id>\d+)/$', 'diff', name="wiki_diff"),
- url(r'^pubmark/(?P<chunk_id>\d+)/$', 'pubmark', name="wiki_pubmark"),
+ url(r'^diff/(?P<chunk_id>\d+)/$', views.diff, name="wiki_diff"),
+ url(r'^pubmark/(?P<chunk_id>\d+)/$', views.pubmark, name="wiki_pubmark"),
- url(r'^themes$', 'themes', name="themes"),
-)
+ url(r'^themes$', views.themes, name="themes"),
+]
# -*- 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<slug>[^/]+)/$',
- 'editor', name="wiki_img_editor"),
+ views.editor, name="wiki_img_editor"),
url(r'^readonly/(?P<slug>[^/]+)/$',
- 'editor_readonly', name="wiki_img_editor_readonly"),
+ views.editor_readonly, name="wiki_img_editor_readonly"),
url(r'^text/(?P<image_id>\d+)/$',
- 'text', name="wiki_img_text"),
+ views.text, name="wiki_img_text"),
url(r'^history/(?P<object_id>\d+)/$',
- 'history', name="wiki_img_history"),
+ views.history, name="wiki_img_history"),
url(r'^revert/(?P<object_id>\d+)/$',
- 'revert', name='wiki_img_revert'),
+ views.revert, name='wiki_img_revert'),
- url(r'^diff/(?P<object_id>\d+)/$', 'diff', name="wiki_img_diff"),
- url(r'^pubmark/(?P<object_id>\d+)/$', 'pubmark', name="wiki_img_pubmark"),
-
-)
+ url(r'^diff/(?P<object_id>\d+)/$', views.diff, name="wiki_img_diff"),
+ url(r'^pubmark/(?P<object_id>\d+)/$', views.pubmark, name="wiki_img_pubmark"),
+]