kopia lustrzana https://github.com/wagtail/wagtail
Add missing ``CustomRendition`` model to the testapp
rodzic
ea2c041c6e
commit
e83d563e30
|
@ -0,0 +1,33 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-10 11:58
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import wagtail.wagtailimages.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('tests', '0014_event_categories'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='CustomRendition',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('filter_spec', models.CharField(db_index=True, max_length=255)),
|
||||
('file', models.ImageField(height_field='height', upload_to=wagtail.wagtailimages.models.get_rendition_upload_to, width_field='width')),
|
||||
('width', models.IntegerField(editable=False)),
|
||||
('height', models.IntegerField(editable=False)),
|
||||
('focal_point_key', models.CharField(blank=True, default='', editable=False, max_length=16)),
|
||||
('image', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='renditions', to='tests.CustomImage')),
|
||||
],
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='customrendition',
|
||||
unique_together=set([('image', 'filter_spec', 'focal_point_key')]),
|
||||
),
|
||||
]
|
|
@ -32,7 +32,7 @@ from wagtail.wagtaildocs.edit_handlers import DocumentChooserPanel
|
|||
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField, AbstractFormSubmission
|
||||
from wagtail.wagtailimages.blocks import ImageChooserBlock
|
||||
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
|
||||
from wagtail.wagtailimages.models import AbstractImage, Image
|
||||
from wagtail.wagtailimages.models import AbstractImage, AbstractRendition, Image
|
||||
from wagtail.wagtailsearch import index
|
||||
from wagtail.wagtailsnippets.edit_handlers import SnippetChooserPanel
|
||||
from wagtail.wagtailsnippets.models import register_snippet
|
||||
|
@ -640,6 +640,15 @@ class CustomImage(AbstractImage):
|
|||
)
|
||||
|
||||
|
||||
class CustomRendition(AbstractRendition):
|
||||
image = models.ForeignKey(CustomImage, related_name='renditions', on_delete=models.CASCADE)
|
||||
|
||||
class Meta:
|
||||
unique_together = (
|
||||
('image', 'filter_spec', 'focal_point_key'),
|
||||
)
|
||||
|
||||
|
||||
class StreamModel(models.Model):
|
||||
body = StreamField([
|
||||
('text', CharBlock()),
|
||||
|
|
Ładowanie…
Reference in New Issue