Mohamed Feddad

54%
Flag icon
from django import forms   class PersonDetailsForm(forms.Form):     name = forms.CharField(max_length=100)     age = forms.IntegerField() This class can be initiated in a bound or unbound manner, as shown in the following code: >>> f = PersonDetailsForm() >>> print(f.as_p()) <p><label for="id_name">Name:</label> <input type="text" name="name" maxlength="100" required id="id_name" /></p> <p><label for="id_age">Age:</label> <input type="number" name="age" required id="id_age" /></p> >>> f.is_bound False >>> g = PersonDetailsForm({"name": "Blitz", "age": "30"}) >>> print(g.as_p()) <p><label ...more
Mohamed Feddad
Generic django form example
Django Design Patterns and Best Practices: Industry-standard web development techniques and solutions using Python, 2nd Edition
Rate this book
Clear rating