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