[Fixed]-Displaying data from database in django form field

1👍

Instead of building the form yourself, you could use Django’s Generic Update View.

Snippet from the docs:

A view that displays a form for editing an existing object, redisplaying the form with validation errors (if there are any) and saving changes to the object. This uses a form automatically generated from the object’s model class (unless a form class is manually specified).

There is even a sufficient example in the docs linked above.

Leave a comment