From b18974bcd71397d9197ccafdf4a405c730b4bb9b Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 28 Nov 2016 18:48:41 +0000 Subject: [PATCH] Remove unnecessary fields --- project/common/migrations/0001_initial.py | 3 +-- project/common/models.py | 2 -- project/projects/migrations/0001_initial.py | 5 ++--- project/projects/models.py | 9 ++------- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/project/common/migrations/0001_initial.py b/project/common/migrations/0001_initial.py index 5f551ce..4142a0e 100644 --- a/project/common/migrations/0001_initial.py +++ b/project/common/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.10.3 on 2016-11-25 21:49 +# Generated by Django 1.10.3 on 2016-11-28 18:43 from __future__ import unicode_literals from django.db import migrations, models @@ -20,7 +20,6 @@ class Migration(migrations.Migration): name='SectionIndexPage', fields=[ ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), - ('name', models.CharField(max_length=250)), ('intro', wagtail.wagtailcore.fields.RichTextField(blank=True)), ('hide_list', models.BooleanField(default=False)), ], diff --git a/project/common/models.py b/project/common/models.py index 32c62dd..7d118dc 100644 --- a/project/common/models.py +++ b/project/common/models.py @@ -12,12 +12,10 @@ class Entity(Page): class SectionIndexPage(Entity): - name = models.CharField(max_length=250) intro = RichTextField(blank=True) hide_list = models.BooleanField(default=False) content_panels = Page.content_panels + [ - FieldPanel('name'), FieldPanel('intro', classname="full"), FieldPanel('hide_list') ] diff --git a/project/projects/migrations/0001_initial.py b/project/projects/migrations/0001_initial.py index 96ad005..34c783a 100644 --- a/project/projects/migrations/0001_initial.py +++ b/project/projects/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.10.3 on 2016-11-25 23:10 +# Generated by Django 1.10.3 on 2016-11-28 18:42 from __future__ import unicode_literals from django.db import migrations, models @@ -23,8 +23,7 @@ class Migration(migrations.Migration): name='ProjectPage', fields=[ ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), - ('date', models.DateField(verbose_name='Post date')), - ('intro', models.CharField(max_length=250)), + ('summary', models.CharField(max_length=500)), ('body', wagtail.wagtailcore.fields.RichTextField()), ('url', models.URLField(blank=True, validators=[project.projects.models.validate_url])), ('download_url', models.URLField(blank=True, validators=[project.projects.models.validate_url])), diff --git a/project/projects/models.py b/project/projects/models.py index 78045c9..1c77099 100644 --- a/project/projects/models.py +++ b/project/projects/models.py @@ -31,8 +31,7 @@ class ProjectPage(Entity): on_delete=models.SET_NULL, related_name='+' ) - date = models.DateField("Post date") - intro = models.CharField(max_length=250) + summary = models.CharField(max_length=500) body = RichTextField() url = models.URLField(validators=[validate_url], blank=True) download_url = models.URLField(validators=[validate_url], blank=True) @@ -44,18 +43,14 @@ class ProjectPage(Entity): related_name='+' ) - def get_download_url(self): - return self.download_url or self.asset.url - search_fields = Page.search_fields + [ index.SearchField('intro'), index.SearchField('body'), ] content_panels = Page.content_panels + [ - FieldPanel('date'), ImageChooserPanel('main_image'), - FieldPanel('intro'), + FieldPanel('summary'), FieldPanel('body'), FieldPanel('url'), FieldPanel('download_url'),