简体   繁体   English

Django-是否有任何方法可以在不使用minidom或lxml库的情况下即时生成一些HTML部分?

[英]Django - Is there any way to generate some HTML parts on the fly without using the minidom or lxml libs?

I am trying to generate some HTML parts in a template directly using Django and python without the Django templating Engine, is there any way to do that just with what Django offers ? 我试图在不使用Django模板引擎的情况下直接使用Django和python在模板中生成一些HTML部分,是否有任何方法可以使用Django提供的功能来做到这一点?

NB: the main reason is that I don't have a model for the data i am trying to make forms for, so using 'ModelForm' is not an option for me since it require an ORM model, witch I don't have ! 注意:主要原因是我没有我要为其创建表单的数据的模型,因此对我而言,使用'ModelForm'并不是一种选择,因为它需要一个ORM模型,而我没有!

Cheers mates, 队友们,

The best solution is to use Django Template Engine as @Daniel Roseman suggested. 最好的解决方案是使用@Daniel Roseman建议的Django模板引擎。 Specifically using the Forms without any bound to any Model is the solution i was looking for, here is SOF link: Can I have a Django form without Model 我一直在寻找一种解决方案,即使用无任何模型绑定的Forms,这里是SOF链接: 我可以拥有一个没有Model的Django表单吗?

Hope this can help someone in the future, Thanks all for your suggestions. 希望这对以后的人有所帮助,谢谢大家的建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM