wagtail django.core.exceptions.FieldError:未知字段;字段在任何地方都不存在
我的 python manage.py makemigrations 返回错误并显示消息
File "/usr/local/lib/python3.6/site-packages/django/forms/models.py", line 268, in __new__
raise FieldError(message)
django.core.exceptions.FieldError: Unknown field(s) (seo_title_fr, title_fr, search_description_en, slug_en, seo_title_en, slug_fr, search_description_fr, title_en) specified for PostPage
我在代码中的任何地方都进行了搜索 这些字段在哪里 我根本没有找到主题 我在数据库 wagtailcore_page 中进行了搜索 我没有找到
id | path | depth | numchild | title | slug | live | has_unpublished_changes | url_path | seo_title | show_in_menus | search_description | go_live_at | expire_at | expired | content_type_id | owner_id | locked | latest_revision_created_at | first_published_at | live_revision_id | last_published_at | draft_title | locked_at | locked_by_id | translation_key | locale_id | alias_of_id | url_path_en | url_path_fr
我在所有代码中搜索的字段,包括迁移但没有找到
我尝试过的任何内容:python manage.py update_translation_fields
但不走运
我的模型是:
import json
from django.db import models
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from django.utils.timezone import now
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse,HttpResponseRedirect, Http404
from django.template.response import TemplateResponse
from django.forms import FileField
from django.core.serializers.json import DjangoJSONEncoder
from wagtail.core.models import Page
from wagtail.core.fields import RichTextField, StreamField
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel, MultiFieldPanel, StreamFieldPanel, FieldRowPanel, PageChooserPanel
from wagtail.images.edit_handlers import ImageChooserPanel
from apps.start_project.google_captcha import google_captcha_validate
from colorfield.fields import ColorField
from modelcluster.fields import ParentalKey
from wagtail.admin.edit_handlers import (
FieldPanel, FieldRowPanel,
InlinePanel, MultiFieldPanel
)
from wagtail.contrib.forms.models import AbstractEmailForm, AbstractFormField, AbstractFormSubmission, FORM_FIELD_CHOICES
from wagtail.contrib.forms.forms import FormBuilder
from wagtail.images.fields import WagtailImageField
from wagtail.contrib.forms.views import SubmissionsListView
from wagtail.documents import get_document_model
from .blocks import blocks
class PostPage(Page):
template_path = RichTextField(null=True, blank=True)
title_html = models.CharField(max_length=100, null=True, blank=True)
description = RichTextField(null=True, blank=True)
keywords = RichTextField(null=True, blank=True)
body = StreamField(
[
("widget_body", blocks.widgetBodyBlock()),
],
null=True,
blank=True,
verbose_name =_('body'),
)
panels = [
FieldRowPanel([
FieldPanel("title_html"),
FieldPanel("description"),
FieldPanel("keywords"),
FieldPanel("template_path"),
]),
StreamFieldPanel("body"),
]
my python manage.py makemigrations return error with message
File "/usr/local/lib/python3.6/site-packages/django/forms/models.py", line 268, in __new__
raise FieldError(message)
django.core.exceptions.FieldError: Unknown field(s) (seo_title_fr, title_fr, search_description_en, slug_en, seo_title_en, slug_fr, search_description_fr, title_en) specified for PostPage
I did serch everywhere in the code where are this fields I didn't find theme at all I did search in database wagtailcore_page I didn't find that fields
id | path | depth | numchild | title | slug | live | has_unpublished_changes | url_path | seo_title | show_in_menus | search_description | go_live_at | expire_at | expired | content_type_id | owner_id | locked | latest_revision_created_at | first_published_at | live_revision_id | last_published_at | draft_title | locked_at | locked_by_id | translation_key | locale_id | alias_of_id | url_path_en | url_path_fr
I did search in all the code including migrations but not found anything
I did try : python manage.py update_translation_fields
but no luck
my model is :
import json
from django.db import models
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from django.utils.timezone import now
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse,HttpResponseRedirect, Http404
from django.template.response import TemplateResponse
from django.forms import FileField
from django.core.serializers.json import DjangoJSONEncoder
from wagtail.core.models import Page
from wagtail.core.fields import RichTextField, StreamField
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel, MultiFieldPanel, StreamFieldPanel, FieldRowPanel, PageChooserPanel
from wagtail.images.edit_handlers import ImageChooserPanel
from apps.start_project.google_captcha import google_captcha_validate
from colorfield.fields import ColorField
from modelcluster.fields import ParentalKey
from wagtail.admin.edit_handlers import (
FieldPanel, FieldRowPanel,
InlinePanel, MultiFieldPanel
)
from wagtail.contrib.forms.models import AbstractEmailForm, AbstractFormField, AbstractFormSubmission, FORM_FIELD_CHOICES
from wagtail.contrib.forms.forms import FormBuilder
from wagtail.images.fields import WagtailImageField
from wagtail.contrib.forms.views import SubmissionsListView
from wagtail.documents import get_document_model
from .blocks import blocks
class PostPage(Page):
template_path = RichTextField(null=True, blank=True)
title_html = models.CharField(max_length=100, null=True, blank=True)
description = RichTextField(null=True, blank=True)
keywords = RichTextField(null=True, blank=True)
body = StreamField(
[
("widget_body", blocks.widgetBodyBlock()),
],
null=True,
blank=True,
verbose_name =_('body'),
)
panels = [
FieldRowPanel([
FieldPanel("title_html"),
FieldPanel("description"),
FieldPanel("keywords"),
FieldPanel("template_path"),
]),
StreamFieldPanel("body"),
]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论