PageRenderTime 126ms CodeModel.GetById 53ms app.highlight 16ms RepoModel.GetById 55ms app.codeStats 0ms

/src/pressroom/migrations/0001_initial.py

http://django-pressroom.googlecode.com/
Python | 124 lines | 90 code | 22 blank | 12 comment | 0 complexity | de76c353f46d60d1f951e11897c0bb1a MD5 | raw file
  1
  2from south.db import db
  3from django.db import models
  4from pressroom.models import *
  5
  6class Migration:
  7    
  8    def forwards(self, orm):
  9        
 10        # Adding model 'Article'
 11        db.create_table('pressroom_article', (
 12            ('id', models.AutoField(primary_key=True)),
 13            ('pub_date', models.DateTimeField("Publish date", default=datetime.datetime.now)),
 14            ('headline', models.CharField(max_length=200)),
 15            ('slug', models.SlugField()),
 16            ('summary', models.TextField(blank=True)),
 17            ('body', models.TextField("Body text")),
 18            ('author', models.CharField(max_length=100)),
 19            ('publish', models.BooleanField("Publish on site", default=True)),
 20        ))
 21        db.send_create_signal('pressroom', ['Article'])
 22        
 23        # Adding model 'Section'
 24        db.create_table('pressroom_section', (
 25            ('id', models.AutoField(primary_key=True)),
 26            ('title', models.CharField(unique=True, max_length=80)),
 27            ('slug', models.SlugField()),
 28        ))
 29        db.send_create_signal('pressroom', ['Section'])
 30        
 31        # Adding model 'Document'
 32        db.create_table('pressroom_document', (
 33            ('id', models.AutoField(primary_key=True)),
 34            ('file', models.FileField("Document")),
 35            ('pub_date', models.DateTimeField("Date published", default=datetime.datetime.now)),
 36            ('title', models.CharField(max_length=200)),
 37            ('slug', models.SlugField()),
 38            ('summary', models.TextField()),
 39        ))
 40        db.send_create_signal('pressroom', ['Document'])
 41        
 42        # Adding ManyToManyField 'Article.documents'
 43        db.create_table('pressroom_article_documents', (
 44            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
 45            ('article', models.ForeignKey(orm.Article, null=False)),
 46            ('document', models.ForeignKey(orm.Document, null=False))
 47        ))
 48        
 49        # Adding ManyToManyField 'Article.photos'
 50        db.create_table('pressroom_article_photos', (
 51            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
 52            ('article', models.ForeignKey(orm.Article, null=False)),
 53            ('photo', models.ForeignKey(orm['photologue.Photo'], null=False))
 54        ))
 55        
 56        # Adding ManyToManyField 'Article.sections'
 57        db.create_table('pressroom_article_sections', (
 58            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
 59            ('article', models.ForeignKey(orm.Article, null=False)),
 60            ('section', models.ForeignKey(orm.Section, null=False))
 61        ))
 62        
 63    
 64    
 65    def backwards(self, orm):
 66        
 67        # Deleting model 'Article'
 68        db.delete_table('pressroom_article')
 69        
 70        # Deleting model 'Section'
 71        db.delete_table('pressroom_section')
 72        
 73        # Deleting model 'Document'
 74        db.delete_table('pressroom_document')
 75        
 76        # Dropping ManyToManyField 'Article.documents'
 77        db.delete_table('pressroom_article_documents')
 78        
 79        # Dropping ManyToManyField 'Article.photos'
 80        db.delete_table('pressroom_article_photos')
 81        
 82        # Dropping ManyToManyField 'Article.sections'
 83        db.delete_table('pressroom_article_sections')
 84        
 85    
 86    
 87    models = {
 88        'pressroom.article': {
 89            'Meta': {'ordering': "['-pub_date']", 'get_latest_by': "'pub_date'"},
 90            'author': ('models.CharField', [], {'max_length': '100'}),
 91            'body': ('models.TextField', ['"Body text"'], {}),
 92            'documents': ('models.ManyToManyField', ["orm['pressroom.Document']"], {'related_name': "'articles'", 'null': 'True', 'blank': 'True'}),
 93            'headline': ('models.CharField', [], {'max_length': '200'}),
 94            'id': ('models.AutoField', [], {'primary_key': 'True'}),
 95            'photos': ('models.ManyToManyField', ["orm['photologue.Photo']"], {'related_name': "'articles'", 'null': 'True', 'blank': 'True'}),
 96            'pub_date': ('models.DateTimeField', ['"Publish date"'], {'default': 'datetime.datetime.now'}),
 97            'publish': ('models.BooleanField', ['"Publish on site"'], {'default': 'True'}),
 98            'sections': ('models.ManyToManyField', ["orm['pressroom.Section']"], {'related_name': "'articles'"}),
 99            'slug': ('models.SlugField', [], {}),
100            'summary': ('models.TextField', [], {'blank': 'True'})
101        },
102        'photologue.photo': {
103            'Meta': {'ordering': "['-date_added']", 'get_latest_by': "'date_added'"},
104            '_stub': True,
105            'id': ('models.AutoField', [], {'primary_key': 'True'})
106        },
107        'pressroom.section': {
108            'Meta': {'ordering': "['title']"},
109            'id': ('models.AutoField', [], {'primary_key': 'True'}),
110            'slug': ('models.SlugField', [], {}),
111            'title': ('models.CharField', [], {'unique': 'True', 'max_length': '80'})
112        },
113        'pressroom.document': {
114            'Meta': {'ordering': "['-pub_date']", 'get_latest_by': "'pub_date'"},
115            'file': ('models.FileField', ['"Document"'], {}),
116            'id': ('models.AutoField', [], {'primary_key': 'True'}),
117            'pub_date': ('models.DateTimeField', ['"Date published"'], {'default': 'datetime.datetime.now'}),
118            'slug': ('models.SlugField', [], {}),
119            'summary': ('models.TextField', [], {}),
120            'title': ('models.CharField', [], {'max_length': '200'})
121        }
122    }
123    
124    complete_apps = ['pressroom']