1
Fork 0

rename fields to fix stuff

This commit is contained in:
Jake Howard 2016-11-28 20:21:56 +00:00
parent b18974bcd7
commit 5d99514c7d
2 changed files with 10 additions and 9 deletions

View file

@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-28 18:42
# Generated by Django 1.10.3 on 2016-11-28 20:04
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import project.projects.models
import wagtail.wagtailcore.fields
@ -13,8 +12,8 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtailcore', '0030_index_on_pagerevision_created_at'),
('wagtaildocs', '0007_merge'),
('wagtailcore', '0030_index_on_pagerevision_created_at'),
('wagtailimages', '0015_fill_filter_spec_field'),
]
@ -25,8 +24,8 @@ class Migration(migrations.Migration):
('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')),
('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])),
('project_url', models.URLField(blank=True)),
('download_url', models.URLField(blank=True)),
('asset', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtaildocs.Document')),
('main_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image')),
],

View file

@ -33,8 +33,8 @@ class ProjectPage(Entity):
)
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)
project_url = models.URLField(blank=True)
download_url = models.URLField(blank=True)
asset = models.ForeignKey(
'wagtaildocs.Document',
null=True,
@ -43,8 +43,10 @@ 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'),
]
@ -52,7 +54,7 @@ class ProjectPage(Entity):
ImageChooserPanel('main_image'),
FieldPanel('summary'),
FieldPanel('body'),
FieldPanel('url'),
FieldPanel('download_url'),
FieldPanel('project_url'),
DocumentChooserPanel('asset')
]