rename fields to fix stuff
This commit is contained in:
parent
b18974bcd7
commit
5d99514c7d
2 changed files with 10 additions and 9 deletions
|
@ -1,10 +1,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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 __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
import project.projects.models
|
|
||||||
import wagtail.wagtailcore.fields
|
import wagtail.wagtailcore.fields
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,8 +12,8 @@ class Migration(migrations.Migration):
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('wagtailcore', '0030_index_on_pagerevision_created_at'),
|
|
||||||
('wagtaildocs', '0007_merge'),
|
('wagtaildocs', '0007_merge'),
|
||||||
|
('wagtailcore', '0030_index_on_pagerevision_created_at'),
|
||||||
('wagtailimages', '0015_fill_filter_spec_field'),
|
('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')),
|
('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)),
|
('summary', models.CharField(max_length=500)),
|
||||||
('body', wagtail.wagtailcore.fields.RichTextField()),
|
('body', wagtail.wagtailcore.fields.RichTextField()),
|
||||||
('url', models.URLField(blank=True, validators=[project.projects.models.validate_url])),
|
('project_url', models.URLField(blank=True)),
|
||||||
('download_url', models.URLField(blank=True, validators=[project.projects.models.validate_url])),
|
('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')),
|
('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')),
|
('main_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image')),
|
||||||
],
|
],
|
||||||
|
|
|
@ -33,8 +33,8 @@ class ProjectPage(Entity):
|
||||||
)
|
)
|
||||||
summary = models.CharField(max_length=500)
|
summary = models.CharField(max_length=500)
|
||||||
body = RichTextField()
|
body = RichTextField()
|
||||||
url = models.URLField(validators=[validate_url], blank=True)
|
project_url = models.URLField(blank=True)
|
||||||
download_url = models.URLField(validators=[validate_url], blank=True)
|
download_url = models.URLField(blank=True)
|
||||||
asset = models.ForeignKey(
|
asset = models.ForeignKey(
|
||||||
'wagtaildocs.Document',
|
'wagtaildocs.Document',
|
||||||
null=True,
|
null=True,
|
||||||
|
@ -43,8 +43,10 @@ class ProjectPage(Entity):
|
||||||
related_name='+'
|
related_name='+'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_download_url(self):
|
||||||
|
return self.download_url or self.asset.url
|
||||||
|
|
||||||
search_fields = Page.search_fields + [
|
search_fields = Page.search_fields + [
|
||||||
index.SearchField('intro'),
|
|
||||||
index.SearchField('body'),
|
index.SearchField('body'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -52,7 +54,7 @@ class ProjectPage(Entity):
|
||||||
ImageChooserPanel('main_image'),
|
ImageChooserPanel('main_image'),
|
||||||
FieldPanel('summary'),
|
FieldPanel('summary'),
|
||||||
FieldPanel('body'),
|
FieldPanel('body'),
|
||||||
FieldPanel('url'),
|
|
||||||
FieldPanel('download_url'),
|
FieldPanel('download_url'),
|
||||||
|
FieldPanel('project_url'),
|
||||||
DocumentChooserPanel('asset')
|
DocumentChooserPanel('asset')
|
||||||
]
|
]
|
||||||
|
|
Reference in a new issue