Я нашел проблемную миграцию, но в чем дело понять не могу:
class Migration(migrations.Migration):
dependencies = [
('filer', '__first__'),
]
operations = [
migrations.CreateModel(
name='Portfolio',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, serialize=False, primary_key=True)),
('name', models.CharField(verbose_name='Название проекта', max_length=255)),
('url', models.URLField()),
('favorite', models.BooleanField(default=False)),
('description', ckeditor.fields.RichTextField(verbose_name='Описание проекта')),
('type', models.CharField(max_length=2, default='OT', choices=[('WS', 'website'), ('PR', 'project'), ('DS', 'design'), ('OS', 'service'), ('OT', 'other')])),
('technology', tagging.fields.TagField(max_length=255, blank=True)),
('promo', filer.fields.image.FilerImageField(blank=True, related_name='promo', null=True, to='filer.Image')),
],
),
migrations.CreateModel(
name='PortfolioImage',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, serialize=False, primary_key=True)),
('image', filer.fields.image.FilerImageField(blank=True, related_name='img', null=True, to='filer.Image')),
('portfolio', models.ForeignKey(related_name='port_image', to='portfolio.Portfolio')),
],
),
]
А вот модель
# -*- coding: utf-8 -*-
from django.db import models
from filer.fields.image import FilerImageField
from ckeditor.fields import RichTextField
from tagging.fields import TagField
import os
from filer.models import Image
from django.conf import settings
# Create your models here.
class Portfolio(models.Model):
name = models.CharField(max_length=255, verbose_name="Название проекта")
url = models.URLField()
favorite = models.BooleanField(default=False)
description = RichTextField(verbose_name="Описание проекта")
promo = FilerImageField(null=True, blank=True, related_name="promo")
TYPE_CHOICES = (
('WS', 'website'),
('PR', 'project'),
('DS', 'design'),
('OS', 'service'),
('OT', 'other')
)
type = models.CharField(max_length=2, choices=TYPE_CHOICES, default='OT')
technology = TagField()
def __unicode__(self):
return self.name + " | " + self.url
def first_image(self):
return settings.MEDIA_URL + str(self.promo.file)
def choices(self):
return self.TYPE_CHOICES
class PortfolioImage(models.Model):
image = FilerImageField(null=True, blank=True, related_name="img")
portfolio = models.ForeignKey(Portfolio, related_name="port_image")