Django forms: How to simply include all attributes in the associated model

Viewed 16132

I am working through how to use Django's forms (https://docs.djangoproject.com/en/1.11/topics/forms/#more-on-fields) and I can't see a way to generate a form structure that is based on a defined Model. In Symfony, I remember I was able to get my form to automatically include all parameters of myModel (for example) even if any new attributes were later added to the model.

For example:

class myModel(models.Model):
    name = models.CharField(max_length=50)
    created=models.DateTimeField(null=False)
    modified=models.DateTimeField(null=True)
    myParameter= models.IntegerField(default=None)
    // ... plus many more parameters

Rather than having to manually type corresponding rows into my class myModelForm(forms.Form):, I'm looking/hoping for a 'catch all'.

1 Answers
Related