我正在django上使用w,并在其中创建问题并允许学生在输入框中键入答案的页面。我使用的是 inline 字段,其中的ag使我可以选择各种输入选项,例如(单行,多行,单选按钮等)。对于我的问题,我正在选择单行选项。我面临的问题是文本框,文本框太小,有没有办法增加文本框的大小(宽度)。
model.py
class QuestionPage(AbstractForm):
intro = RichTextField(blank=True)
thank_you_text = RichTextField(blank=True)
points_for_this_activity = models.IntegerField(blank=True, default=0)
content_panels = AbstractEmailForm.content_panels + [
FieldPanel('intro', classname="full"),
InlinePanel('form_fields', label="Create your question"),
FieldPanel('points_for_this_activity', classname="title"),
FieldPanel('thank_you_text', classname="full"),
]
question.html
<div class ="container">
<h1>{{ page.title }}</h1>
{% if user.is_authenticated and user.is_active or request.is_preview %}
{% if form %}
<div>{{ page.intro|richtext }}</div>
<form action="{% pageurl page %}" method="POST">
{% csrf_token %}
{{ form.as_p }}
<input class="btn-md btn-primary" type="submit">
</form>
{% else %}
<div>You have already answered this. Go to the next question.</div>
{% endif %}
{% else %}
<div>To fill in the form, you should log in.</div>
{% endif %}
{% endblock %}
</div>