Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 如何在Wagtail中为页面模型编写自定义视图?_Python 3.x_Django_Wagtail - Fatal编程技术网

Python 3.x 如何在Wagtail中为页面模型编写自定义视图?

Python 3.x 如何在Wagtail中为页面模型编写自定义视图?,python-3.x,django,wagtail,Python 3.x,Django,Wagtail,我在models.py中有一个页面对象,如下所示: class PostPage(Page): template = 'Blog/post_page.html' # Database fields body = RichTextField() main_image = models.ForeignKey( 'wagtailimages.Image', null=True, blank=True, on

我在
models.py中有一个页面对象,如下所示:

class PostPage(Page):
    template = 'Blog/post_page.html'
    # Database fields
    body = RichTextField()
    main_image = models.ForeignKey(
        'wagtailimages.Image',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+'
    )

    promote_panels = [
        InlinePanel('related_links', label="Related links"),
        MultiFieldPanel(Page.promote_panels, "Common page configuration"),
    ]
    ....
class PostPageView(PermissionMixin, PostPage):
    required_permission = 'special_user'
我想在
views.py
中将此页面与另一个视图混合使用,如下所示:

class PostPage(Page):
    template = 'Blog/post_page.html'
    # Database fields
    body = RichTextField()
    main_image = models.ForeignKey(
        'wagtailimages.Image',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+'
    )

    promote_panels = [
        InlinePanel('related_links', label="Related links"),
        MultiFieldPanel(Page.promote_panels, "Common page configuration"),
    ]
    ....
class PostPageView(PermissionMixin, PostPage):
    required_permission = 'special_user'
django角色权限的某些视图
通用视图

我该怎么做?在将它们混合在一起之后,我如何解释上下文处理器使用
PostPage view
而不是
PostPage

另一个问题是如何设置页面对象的视图?我在Wagtail admin中找到了
CreateView
EditView
,但找不到
DetailView
的任何内容