我有一个显示为1行的表格。我希望窗口的大小根据输入的文本量动态扩展:
这是它所在页面的html信息:
home.html
<div class="container">
<div class="jumbotron jumbotron-fluid">
<div class="row">
<div class="col-md-6">
{% if request.user.is_authenticated %}
<form action="" method="POST">
{% csrf_token %}
{{ form2|crispy }}<br>
<input type="submit" name="submit" value="Paste" id="submit" class="btn btn-primary">
</form>
{% endif %}
</div>
forms.py
from django import forms
from pastes.models import Paste
class PostForm(forms.ModelForm):
SYNTAX_CHOICES = {
(0, "Plain"),
(1, "Python"),
(2, "HTML"),
(3, "SQL"),
(4, "Javascript"),
(5, "CSS"),
}
class Meta:
model = Paste
fields = ('title', 'content', 'syntax', 'public')
widgets = {"title": forms.TextInput(attrs={"class": "form-control"})}