1👍
✅
You can change the width and height of the widget by applying CSS to the <select>
element that Django creates.
11👍
Override the form’s __init__
method and add:
self.fields['Person'].widget.attrs['size']='10'
👤greg
- [Django]-Crontab is running but still not executing command Django
- [Django]-Inconsistent SignatureDoesNotMatch Amazon S3 with django-pipeline, s3boto and storages
- [Django]-Django mongodbforms exception when rendering embedded formset management_form
- [Django]-Disadvantages of sharing Django sessions on multiple subdomains
- [Django]-Use context processor only for specific application
5👍
Try this:
from django.forms import widgets
class FilterForm(forms.Form):
Person = forms.ModelMultipleChoiceField(required=False, queryset=Person.objects.all(), widget=widgets.SelectMultiple(attrs={'size': 20}))
- [Django]-ElasticSearch term suggest on analyzed field returns no suggestions
- [Django]-Django-compressor: disable caching using precompilers
- [Django]-ImportError: cannot import name <model_class>
- [Django]-Django Mongodb Engine : Authentication, Sessions ans User Model
Source:stackexchange.com