Linking a model to a form
Linking a model to a form without needing any special field rendering is fairly easy.
In your /chapter_5/forms.py
file, add the following code to the existing VehicleForm
class (remember to remove the pass
statement that was added to this class earlier):
# /becoming_a_django_entdev/chapter_5/forms.py
...
from django.forms
import Form, ModelForm
from ..chapter_3.models
import Vehicle
class VehicleForm(ModelForm):
class Meta:
model = Vehicle
fields = [
'vin',
'sold',
'price',
&apos...