方便快捷的pdf导出工具
Project description
新加PdfAdmin,如有需要导出pdf的admin直接继承PdfAdmin 如需在列表添加查看pdf功能,在list_display中添加'pdf_show'字段
setting.py中
INSTALLED_APPS = [
----------其他APP
'pdfExport'
-----------其他APP
]
admin中
注pdf_fields中可加入的元素
1.filed1和filed2字段各占一行
pdf_fields = ('filed1','filed2')
2.filed1和filed2字段共占一行,filed3单独一行
pdf_fields = (('filed1','filed2'),'filed3')
3.filed1和filed2字段共占一行,filed3单独一行,title1为filed1和filed2的标题,title2为filed3标题
pdf_fields = (('title1', {('filed1', 'filed2')}), ('title2', {('filed3',)}),'filed4')
@admin.register(TodoItem)
class TodoItemAdminBase(PdfAdmin):
list_display = ('title', 'assignee', 'created_at', 'updated_at', 'is_completed', 'pdf_show')
list_filter = ('created_at', 'updated_at', 'assignee')
search_fields = ('title', 'assignee')
# pdf要显示的字段
# 注:每行最多放两个字段
pdf_fields = (('组标题', {('title', 'assignee')}), 'handler', ('时间', {('created_at',)}), 'type')
# pdf标题
pdf_title = '策略申请表'
# 要显示所有选项的字段
option_fields = ['type', ]
# 左右上方小标题
left_tip = '编号AAA'
right_tip = '编号BBB'
# 如有其他需求,可以自定义pdf_template,继承base_pdf_template.html,添加需要的模块
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
qz_pdf_export-0.1.6.tar.gz
(9.4 kB
view hashes)
Built Distribution
Close
Hashes for qz_pdf_export-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfabd4c9599794c3bb821500fa34c002d94f78e63c4d7abf2846035e96944413 |
|
MD5 | aeda4ff43af1513e1200b6ff384db5a8 |
|
BLAKE2b-256 | e938864213011c808def8e6830fe6cf0b24513118eb87af3410cc0f761e998e5 |