Try setting the initial value when you instantiate the form:
form = MyForm(initial={'max_number': '3'})
More Related Contents:
- Django ModelForm: What is save(commit=False) used for?
- How do I add a Foreign Key Field to a ModelForm in Django?
- How can I restrict Django’s GenericForeignKey to a list of models?
- Dropdown in Django Model
- Django – Overriding the Model.create() method?
- Django unique_together with nullable ForeignKey
- How to add Check Constraints for Django Model fields?
- Dynamic File Path in Django
- Django: Populate user ID when saving a model
- Get model’s fields in Django
- Can django’s auth_user.username be varchar(75)? How could that be done?
- Django form field choices, adding an attribute
- Using a UUID as a primary key in Django models (generic relations impact)
- Django ManyToMany filter()
- Create Custom Error Messages with Model Forms
- Django delete FileField
- Why does django’s prefetch_related() only work with all() and not filter()?
- Django multi-select widget?
- How to register users in Django REST framework?
- Django : Unable to import model from another App
- django.db.utils.IntegrityError: UNIQUE constraint failed: rango_category__new.slug
- Django Order By Date, but have “None” at end?
- How to add a sortable count column to the Django admin of a model with a many-to-one relation?
- Django Forms: pass parameter to form
- Password field in Django model
- How to limit file types on file uploads for ModelForms with FileFields?
- Django: access the parent instance from the Inline model admin
- Creating Partial Indexes with Django 1.7
- Django – forms.FileField() initial value
- Django ModelForm to have a hidden input