Guilherme Gondim avatar Guilherme Gondim committed d2ab036

Remove ContentBlock, sites support and meta_* fields

Comments (0)

Files changed (5)

         (None, {
             'fields': ('title', 'path', 'content')
         }),
-        (_('Search Engine Optimization (SEO)'), {
-            'classes': ('collapse',),
-            'fields': ('meta_keywords', 'meta_description')
-        }),
         (_('Advanced options'), {
             'classes': ('collapse',),
             'fields': ('template', 'sites')
     search_fields = ('path', 'title', 'content', 'template__title')
 
 
-admin.site.register(models.ContentBlock)
 admin.site.register(models.Page, PageAdmin)
 admin.site.register(models.Template)

paginas/migrations/0006_auto__add_contentblock.py

-# -*- 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 'ContentBlock'
-        db.create_table(u'paginas_contentblock', (
-            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
-            ('slug', self.gf('django.db.models.fields.SlugField')(max_length=64)),
-            ('description', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),
-            ('content', self.gf('django.db.models.fields.TextField')(blank=True)),
-            ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
-            ('modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
-        ))
-        db.send_create_signal(u'paginas', ['ContentBlock'])
-
-        # Adding M2M table for field sites on 'ContentBlock'
-        m2m_table_name = db.shorten_name(u'paginas_contentblock_sites')
-        db.create_table(m2m_table_name, (
-            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
-            ('contentblock', models.ForeignKey(orm[u'paginas.contentblock'], null=False)),
-            ('site', models.ForeignKey(orm[u'sites.site'], null=False))
-        ))
-        db.create_unique(m2m_table_name, ['contentblock_id', 'site_id'])
-
-
-    def backwards(self, orm):
-        # Deleting model 'ContentBlock'
-        db.delete_table(u'paginas_contentblock')
-
-        # Removing M2M table for field sites on 'ContentBlock'
-        db.delete_table(db.shorten_name(u'paginas_contentblock_sites'))
-
-
-    models = {
-        u'paginas.contentblock': {
-            'Meta': {'ordering': "('slug',)", 'object_name': 'ContentBlock'},
-            'content': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
-            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
-            'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
-            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
-            'sites': ('django.db.models.fields.related.ManyToManyField', [], {'default': '[1]', 'to': u"orm['sites.Site']", 'symmetrical': 'False'}),
-            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '64'})
-        },
-        u'paginas.page': {
-            'Meta': {'ordering': "('path',)", 'object_name': 'Page'},
-            'content': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
-            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
-            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'meta_description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
-            'meta_keywords': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
-            'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
-            'path': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
-            'sites': ('django.db.models.fields.related.ManyToManyField', [], {'default': '[1]', 'to': u"orm['sites.Site']", 'symmetrical': 'False'}),
-            'template': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['paginas.Template']", 'null': 'True', 'blank': 'True'}),
-            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
-        },
-        u'paginas.template': {
-            'Meta': {'ordering': "('title',)", 'object_name': 'Template'},
-            'file_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'title': ('django.db.models.fields.CharField', [], {'max_length': '64'})
-        },
-        u'sites.site': {
-            'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
-            'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
-            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
-        }
-    }
-
-    complete_apps = ['paginas']

paginas/migrations/0006_auto__del_field_page_meta_keywords__del_field_page_meta_description.py

+# -*- 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):
+        # Deleting field 'Page.meta_keywords'
+        db.delete_column(u'paginas_page', 'meta_keywords')
+
+        # Deleting field 'Page.meta_description'
+        db.delete_column(u'paginas_page', 'meta_description')
+
+
+    def backwards(self, orm):
+        # Adding field 'Page.meta_keywords'
+        db.add_column(u'paginas_page', 'meta_keywords',
+                      self.gf('django.db.models.fields.CharField')(default='', max_length=128, blank=True),
+                      keep_default=False)
+
+        # Adding field 'Page.meta_description'
+        db.add_column(u'paginas_page', 'meta_description',
+                      self.gf('django.db.models.fields.CharField')(default='', max_length=255, blank=True),
+                      keep_default=False)
+
+
+    models = {
+        u'paginas.page': {
+            'Meta': {'ordering': "('path',)", 'object_name': 'Page'},
+            'content': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+            'path': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
+            'sites': ('django.db.models.fields.related.ManyToManyField', [], {'default': '[1]', 'to': u"orm['sites.Site']", 'symmetrical': 'False'}),
+            'template': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['paginas.Template']", 'null': 'True', 'blank': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        u'paginas.template': {
+            'Meta': {'ordering': "('title',)", 'object_name': 'Template'},
+            'file_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '64'})
+        },
+        u'sites.site': {
+            'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
+            'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        }
+    }
+
+    complete_apps = ['paginas']

paginas/migrations/0007_auto.py

+# -*- 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):
+        # Removing M2M table for field sites on 'Page'
+        db.delete_table(db.shorten_name(u'paginas_page_sites'))
+
+
+    def backwards(self, orm):
+        # Adding M2M table for field sites on 'Page'
+        m2m_table_name = db.shorten_name(u'paginas_page_sites')
+        db.create_table(m2m_table_name, (
+            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+            ('page', models.ForeignKey(orm[u'paginas.page'], null=False)),
+            ('site', models.ForeignKey(orm[u'sites.site'], null=False))
+        ))
+        db.create_unique(m2m_table_name, ['page_id', 'site_id'])
+
+
+    models = {
+        u'paginas.page': {
+            'Meta': {'ordering': "('path',)", 'object_name': 'Page'},
+            'content': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+            'path': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
+            'template': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['paginas.Template']", 'null': 'True', 'blank': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        u'paginas.template': {
+            'Meta': {'ordering': "('title',)", 'object_name': 'Template'},
+            'file_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '64'})
+        }
+    }
+
+    complete_apps = ['paginas']

paginas/models.py

 from django.utils.translation import ugettext_lazy as _
 
 
-class ContentBlock(models.Model):
-    slug = models.SlugField(_('slug'), max_length=64)
-    description = models.CharField(_('description'), max_length=255, blank=True)
-    content = models.TextField(_('content'), blank=True)
-    created = models.DateTimeField(_('created'), auto_now_add=True)
-    modified = models.DateTimeField(_('modified'), auto_now=True)
-    sites = models.ManyToManyField(Site, default=[settings.SITE_ID])
-
-    objects = models.Manager()
-    on_site = CurrentSiteManager()
-
-    class Meta:
-        verbose_name = _('content block')
-        verbose_name_plural = _('content blocks')
-        ordering = ('slug',)
-
-    def __unicode__(self):
-        return u'{}'.format(self.slug)
-
-
 class Page(models.Model):
     title = models.CharField(_('title'), max_length=255)
     path = models.CharField(
         'Template',
         verbose_name=_('template'),
         null=True, blank=True,
-        help_text=_("If this isn't provided, the system will use "
-                    "<i>paginas/default.html</i>.")
     )
 
     created = models.DateTimeField(_('created'), auto_now_add=True)
     modified = models.DateTimeField(_('modified'), auto_now=True)
-    sites = models.ManyToManyField(Site, default=[settings.SITE_ID])
-
-    # SEO
-    meta_description = models.CharField(_('description'), max_length=255, blank=True)
-    meta_keywords = models.CharField(
-        _('keywords'),
-        max_length=128,
-        blank=True,
-        help_text=_('Separated by commas.')
-    )
-
-    objects = models.Manager()
-    on_site = CurrentSiteManager()
 
     class Meta:
         verbose_name = _('page')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.