gpp/port/forms.py
2019-06-08 13:08:57 +02:00

64 lines
2.0 KiB
Python

from django.forms import Form, CharField, IntegerField, DecimalField, \
BooleanField, EmailField, DateTimeField, ImageField, formset_factory
from django_countries.fields import CountryField
from phonenumber_field.formfields import PhoneNumberField
class PersonForm(Form):
name = CharField(label='Name', max_length=50)
surname = CharField(label='Surname', max_length=50)
nationality = CountryField().formfield(label='Nationality')
email = EmailField(label='E-Mail')
phone = PhoneNumberField(label='Phone Number')
class AddressForm(Form):
address = CharField(label='Name', max_length=200)
zip_code = CharField(label='ZipCode', max_length=10)
city = CharField(label='City', max_length=200)
country = CountryField().formfield(label='Country')
class DockForm(Form):
name = CharField(label='Name', max_length=10)
length = DecimalField(
label='Length', min_value=0,
max_digits=7,
decimal_places=2)
width = DecimalField(
label='Width', min_value=0,
max_digits=7,
decimal_places=2)
depth_min = DecimalField(
label='Depth (min.)', min_value=0,
max_digits=7,
decimal_places=2)
depth_max = DecimalField(
label='Depth (max.)', min_value=0,
max_digits=7,
decimal_places=2)
DockFormSet = formset_factory(DockForm)
class PortForm(Form):
name = CharField(label='Name', max_length=50)
address = CharField(label='Address', max_length=50)
company = CharField(label='Company', max_length=50)
class PlugForm(Form):
name = CharField(label='Name', max_length=10)
amperage = DecimalField(
label='Amperage',
min_value=0,
max_digits=3,
decimal_places=0)
voltage = DecimalField(
label='Voltage',
min_value=0,
max_digits=3,
decimal_places=0)
PlugFormSet = formset_factory(PlugForm)
class TapForm(Form):
name = CharField(label='Name', max_length=10)
TapFormSet = formset_factory(TapForm)