From: Lukasz Anwajler Date: Tue, 18 Jan 2011 14:05:17 +0000 (-0600) Subject: Added migrations to lessons. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/0321c7661ccabef17a106fecf6580f5413d9057d?ds=inline Added migrations to lessons. --- diff --git a/apps/lessons/migrations/0001_initial.py b/apps/lessons/migrations/0001_initial.py new file mode 100644 index 000000000..9374d6118 --- /dev/null +++ b/apps/lessons/migrations/0001_initial.py @@ -0,0 +1,45 @@ +# 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 'Document' + db.create_table('lessons_document', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('title', self.gf('django.db.models.fields.CharField')(max_length=120)), + ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)), + ('file', self.gf('django.db.models.fields.files.FileField')(max_length=100)), + ('author', self.gf('django.db.models.fields.CharField')(max_length=120, blank=True)), + ('slideshare_id', self.gf('django.db.models.fields.CharField')(max_length=120, blank=True)), + ('description', self.gf('django.db.models.fields.TextField')(blank=True)), + ('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), + )) + db.send_create_signal('lessons', ['Document']) + + + def backwards(self, orm): + + # Deleting model 'Document' + db.delete_table('lessons_document') + + + models = { + 'lessons.document': { + 'Meta': {'object_name': 'Document'}, + 'author': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'slideshare_id': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}) + } + } + + complete_apps = ['lessons'] diff --git a/apps/lessons/migrations/0002_auto__add_field_document_html.py b/apps/lessons/migrations/0002_auto__add_field_document_html.py new file mode 100644 index 000000000..2254bf328 --- /dev/null +++ b/apps/lessons/migrations/0002_auto__add_field_document_html.py @@ -0,0 +1,36 @@ +# 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 'Document.html' + db.add_column('lessons_document', 'html', self.gf('django.db.models.fields.TextField')(default=None, blank=True), keep_default=False) + + + def backwards(self, orm): + + # Deleting field 'Document.html' + db.delete_column('lessons_document', 'html') + + + models = { + 'lessons.document': { + 'Meta': {'object_name': 'Document'}, + 'author': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'html': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'slideshare_id': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}) + } + } + + complete_apps = ['lessons'] diff --git a/apps/lessons/migrations/__init__.py b/apps/lessons/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/apps/lessons/models.py b/apps/lessons/models.py index ffb2b6c96..412dc6bc5 100644 --- a/apps/lessons/models.py +++ b/apps/lessons/models.py @@ -16,6 +16,7 @@ class Document(models.Model): slideshare_id = models.CharField(_('slideshare ID'), blank=True, max_length=120) description = models.TextField(_('description'), blank=True) created_at = models.DateTimeField(auto_now_add=True) + html = models.TextField(_('HTML'), blank=True) # HTML content, alternative for Flash def slideshare_player(self): base, ext = path.splitext(self.file.name)