首页 \ 问答 \ 如何使用Google App Engine自动化Google文档?(How can I automate google docs with Google App Engine?)

如何使用Google App Engine自动化Google文档?(How can I automate google docs with Google App Engine?)

Listmates:

我正在设计一个谷歌应用程序引擎(python)应用程序来自动化律师事务所文件。

我计划使用GAE,谷歌文档和谷歌驱动器来创建和存储完成的文档。 我的计划是使用GAE网络表单和Google数据存储区输入和检索案例信息(客户名称,案例编号等)。 然后我将允许用户通过将表单数据插入模板来创建动作或其他文档。

完成的文档可以由用户进一步定制,发送电子邮件,打印和/或存储在谷歌驱动器文件夹中。

我找到了有关如何创建可以打印的网页的信息。 但是,我正在寻找有关如何创建实际谷歌文档并将表单数据插入该文档或模板的信息。

有人能指出我的任何类型的GAE教程,它指导我如何做到这一点?


Listmates:

I am designing a google app engine (python) app to automate law office documents.

I plan on using GAE, google docs, and google drive to create and store the finished documents. My plan is to have case information (client name, case number, etc.) entered and retrieved using GAE web forms and the google datastore. Then I will allow the user to create a motion or other document by inserting the form data into template.

The completed document can be further customized by the user, email, printed, and/or stored in a google drive folder.

I found information on how to create a web page that can be printed. However, I am looking for information for how to create an actual google doc and insert the form data into that document or template.

Can someone point me to a GAE tutorial of any type that steps me through how to do this?


原文:https://stackoverflow.com/questions/19745169
更新时间:2023-03-25 09:03

最满意答案

假设附加到您的类别的对象称为Advert

{% for categ in categs %}

    {{ categ.name }} ({{ categ.advert_set.count }})

{% endfor %}

如果您在models.py文件中的Category ModelClass中更改了广告的属性advert_set ,则必须将advert_set调整为相应的advert_set

有关如何访问相关对象的更多信息,请查看文档


Assuming the objects attached to your categories are called Adverts:

{% for categ in categs %}

    {{ categ.name }} ({{ categ.advert_set.count }})

{% endfor %}

If you changed the attribute related_name of your Adverts in the Category ModelClass in your models.py file you'll have to adjust advert_set to the corresponding related_name.

For more information about how to access related objects take a look at the docs.

相关问答

更多
  • 一般原则是从要检索的对象开始,或者在这种情况下计数。 因此,您需要从ShopProduct开始并遵循关系。 在一个视图中将是: ShopProduct.objects.filter(subcategory__category__section=my_section) 但是,您无法在模板中执行此操作,因为您无法使用参数调用方法。 因此,您需要将此定义为Section类的方法,将my_section替换为self ,然后您可以执行(例如) {{ section.get_product_count }} 。 T ...
  • 您可以编写模板标记来设置上下文值: from django.template.base import Library register = Library() @register.simple_tag(takes_context=True) def set_by(context, k, v): context[k] = v return v {# template #} {% with totalDividend=0.0 %} {% for dividend in stock.d ...
  • 您可以删除所需的任何QuerySet。 例如,要删除一些Post模型的所有博客帖子 Post.objects.all().delete() 并删除任何发布日期 Post.objects.filter(pub_date__gt=datetime.now()).delete() 但是,您需要提出一种缩小查询集的方法。 如果您只是想要删除特定对象的视图,请查看删除通用视图 。 编辑: 很抱歉对于这个误会。 我认为答案是在某处之间。 要实现自己的,结合ModelForm和通用视图 。 否则,请查看提供类似功能的 ...
  • 我不确定我是否理解你为什么有问题,因为你目前的解决方案似乎有效。 我不认为你需要HTML注释,因为{% cycle %}与as不会输出任何内容,但除此之外看起来好像很好。 但是,如果您需要其他方式来执行此操作,则可以使用divisibleby过滤器: {% for day in days %} {% if forloop.counter|divisibleby:3 %} {% rounded "black" "day last" %} {% else %} {% rounded ...
  • 假设附加到您的类别的对象称为Advert : {% for categ in categs %} {{ categ.name }} ({{ categ.advert_set.count }}) {% endfor %} 如果您在models.py文件中的Category ModelClass中更改了广告的属性advert_set ,则必须将advert_set调整为相应的advert_set 。 有关如何访问相关对象的更多信息,请查看文档 。 Assuming the objects atta ...
  • Django在其模板中具有有限的功能,因此更容易迭代您希望显示的元素。 例如,您可以在视图中准备数据,只包含五个元素: latest_item_list = Manga.objects.all().order_by('-added_on')[:5] chapters = Chapter.objects.all().order_by('-chapter') latest_chapter_per_mange = compute_chapters_per_mange(chapters, latest_item_l ...
  • 首先附上你的restults列表距离和家庭作为元组。 然后,您可以在results列表中使用sort方法将函数传递给sort方法的key关键字参数。 例如, results.sort(key=lambda item:item[0])会使sort方法比较它所排序的每个项目的第一个元素。 请参阅: Python列表排序方法 我就是这样做的: results = [] for home in homes: home_coords = [home.latitude, home.longtitude] ...
  • 对于循环标记,两个参数将交替添加到模板中,例如,模板中的代码{% for o in some_list %}{% endfor %}会生成: ... ... ... ...