Form to ModelForm

This commit is contained in:
maxime 2019-06-08 13:59:32 +02:00
parent ecc7552c20
commit 482e0b4487
1 changed files with 6 additions and 6 deletions

View File

@ -7,7 +7,7 @@ from phonenumber_field.formfields import PhoneNumberField
from .models import *
class PersonForm(Form):
class PersonForm(ModelForm):
class Meta:
model = Person
@ -26,7 +26,7 @@ class PersonForm(Form):
phone = PhoneNumberField(label='Phone Number')
"""
class AddressForm(Form):
class AddressForm(ModelForm):
class Meta:
model = Address
@ -86,7 +86,7 @@ class PortForm(ModelForm):
company = CharField(label='Company', max_length=50)
"""
class PlugForm(Form):
class PlugForm(ModelForm):
class Meta:
model = Plug
@ -112,7 +112,7 @@ class PlugForm(Form):
PlugFormSet = formset_factory(PlugForm)
class TapForm(Form):
class TapForm(ModelForm):
class Meta:
model = Tap
@ -125,5 +125,5 @@ class TapForm(Form):
TapFormSet = formset_factory(TapForm)
class BoatForm(Form):
class BoatForm(ModelForm):
pass