我已经将pdf上传到了我的wagtail页面,但我不知道如何让它们可以从网页本身下载。这是我的models.py文件代码
我需要什么html代码来制作这些
class ArchitectPage(Page):
pdf_files = models.ForeignKey(
'wagtaildocs.Document',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
search_fields = Page.search_fields + [
] # these are if adding a search to the website
# content tab panels
content_panels = Page.content_panels + [
MultiFieldPanel(
[InlinePanel('architect_pdf', max_num=20, min_num=0, label="architect pdf")],
heading="architect pdf"
),
]
# what to call the panels on wagtail
edit_handler = TabbedInterface([
ObjectList(content_panels, heading='Content'),
ObjectList(Page.promote_panels, heading='SEO'),
ObjectList(Page.settings_panels, heading='Settings', classname='settings'),
# classname settings adds the cog
])
class ArchitectDownloads(Orderable):
page = ParentalKey(ArchitectPage, on_delete=models.CASCADE, related_name='architect_pdf')
architect_pdf = models.ForeignKey(
'wagtaildocs.Document',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
panels = [
DocumentChooserPanel('architect_pdf'),
]
相关问题 更多 >
编程相关推荐