Grokking Django
Vote

0% completed

​

Working with ModelForms for Database Interaction

A plain form for the blog's Article model would repeat five field definitions that the model already contains, with the same names, the same types and the same 200-character limit on the title. Every later change to the model would then have to be made twice. A ModelForm removes that repetition. It reads the fields from the model, builds the matching form fields, validates the data against the model's rules, and saves the result as a database row with one call.

The Article Model

The examples use the Article model as the models chapter left it, with its Author and Tag models

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content