[英]styling django forms using reactjs
I learnt about django-forms, and I wanna create a form which looks nice, styling with css and bootstrap and html. 我了解了django-forms,我想创建一个看起来不错的表单,使用css和bootstrap以及html进行样式化。 but I found that out that I can't do it clean (like creating separate css sheet for styling) and I have to do it through python code which is doesn't look good.
但我发现我不能干净(就像创建单独的css表格样式)而且我必须通过python代码来做这个看起来不太好。 is there any way to do this?
有没有办法做到这一点? if I try to handle the whole frontend, do I still need to set some styles through python in backend including django forms?
如果我尝试处理整个前端,我还需要在后端设置一些包含django表单的样式吗? I'm sorry if it is a dumb question but I'm new to reactjs(actually I didn't learn it yet) and I have just a little experience in django.
我很抱歉,如果这是一个愚蠢的问题,但我是新来的反应(实际上我还没有学到它),我只有一点django的经验。
Why do you need to do this through Python code and who says that you can't create separate CSS style sheets? 为什么需要通过Python代码执行此操作,谁说您无法创建单独的CSS样式表?
Just use a template which is then loaded in Django. 只需使用一个然后在Django中加载的模板。 Within the template you can take each and every input field from your forms.py and show it separately by adding
在模板中,您可以从forms.py中获取每个输入字段,并通过添加单独显示它
{{ form.first_field }}
for example. 例如。 If you want to learn more on this read the documentation here .
如果您想了解更多信息,请阅读此处的文档 。
Separate CSS sheets, you can just include in the head of the HTML template. 单独的CSS工作表,您可以只包含在HTML模板的头部。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.