Jacob Kaplan-Moss has an extensive writeup on dynamic form fields:
http://jacobian.org/writing/dynamic-form-generation/
Essentially, you add more items to the form’s self.fields
dictionary during instantiation.
More Related Contents:
- Django Passing Custom Form Parameters to Formset
- django submit two different forms with one submit button
- Django required field in model form
- Django: How to build a custom form widget?
- Django edit form based on add form?
- Django equivalent of PHP’s form value array/associative array
- Add class to Django label_tag() output
- Dynamically creating classes – Python
- How to remove a field from the parent Form in a subclass?
- Django – Working with multiple forms
- Django set default form values
- Creating a dynamic choice field
- ImproperlyConfigured: You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings
- Django model “doesn’t declare an explicit app_label”
- Django Admin – change header ‘Django administration’ text
- How to set-up a Django project with django-storages and Amazon S3, but with different folders for static files and media files?
- Django cannot find static files. Need a second pair of eyes, I’m going crazy
- How can I auto-populate a PDF form in Django/Python? [closed]
- Gunicorn, no module named ‘myproject
- ImportError: cannot import name ‘…’ from partially initialized module ‘…’ (most likely due to a circular import)
- How to extract PDF fields from a filled out form in Python?
- Django Many-to-Many (m2m) Relation to same model
- How to log all sql queries in Django?
- Simple approach to launching background task in Django
- django-cors-headers not work
- Unable to import path from django.urls
- no module named urllib.parse (How should I install it?)
- django excel xlwt
- Django Tastypie: How to Authenticate with API Key
- Deploying Django to Heroku (Psycopg2 Error)