开发者

Django: Form field size

开发者 https://www.devze.com 2023-03-10 02:47 出处:网络
In Django Templates, how do i specify the size of a field This is 开发者_开发百科my form class:

In Django Templates, how do i specify the size of a field

This is 开发者_开发百科my form class:

class PstForm(forms.Form):
     hours = forms.ChoiceField(choices=[(6,6),(24,24),(48,48)], widget=forms.Select(attrs={'size':'3'}))

however this still renders a rather long field

how do i limit the size?


You could try adjusting the CSS: attrs={'style': 'width:10px'}, (or 'class': 'some-class', etc).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号