如何为 Django 创建 Postgres ltree 数据类型?以及如何将它与 QuerySet 一起使用?(创建包装?如何?)
关于lree: http: //www.postgresql.org/docs/current/static/ltree.html
关于 Django 中的自定义字段:docs.djangoproject.com/en/1.2/howto/custom-model-fields/
PS 还有“Django Tree Libraries”,但 ltree 看起来更好..
我需要允许用户编辑和打印与客户相关的文档(发票和其他)。
用户填写打印表格(选择客户,月份,他/她需要四种类型的文档中的每种的多少份)并单击以打印按钮。
接下来,我的系统应该做(算法):
result = create new word-friendly file # because user may manually edit it later
for client in form_clients:
snapshot = select row in snapshots table
where client == client and month == form_month
document1 = generate_from_template(snapshot, tpl1.docx)
for 1 to form_how_much_copies_of_1_type_of_document_he_or_she_needs:
result += document1
document2 = generate_from_template(snapshot, tpl2.docx)
for 1 to form_how_much_copies_of_2_type_of_document_he_or_she_needs:
result += document2
document3 = generate_from_template(snapshot, tpl3.docx)
for 1 to form_how_much_copies_of_3_type_of_document_he_or_she_needs:
result += document3
document4 = generate_from_template(snapshot, tpl4.docx)
for 1 to form_how_much_copies_of_4_type_of_document_he_or_she_needs:
result += document4 …Run Code Online (Sandbox Code Playgroud)