from wtforms.validators import DataRequired, Optional

from web.blueprints.facilities.forms import SelectRoomForm
from web.form.fields.core import TextField, QuerySelectField, \
    SelectMultipleField
from web.form.fields.custom import UserIDField, MacField
from flask_wtf import FlaskForm as Form

from web.form.fields.validators import MacAddress


class HostForm(SelectRoomForm):
    owner_id = UserIDField(u"Besitzer-ID")
    name = TextField(u"Name", validators=[Optional()],
                     description=u"z.B. TP-LINK WR841, FritzBox 4040 oder MacBook")

    _order = ("name", "owner_id")


class InterfaceForm(Form):
    name = TextField(u"Name",description=u"z.B. eth0, en0 oder enp0s29u1u1u5")
    mac = MacField(u"MAC", [MacAddress(message=u"MAC ist ungültig!")])
    ips = SelectMultipleField(u"IPs", validators=[Optional()])

from wtforms.validators import DataRequired, Optional

from web.blueprints.facilities.forms import SelectRoomForm
from web.form.fields.core import TextField, QuerySelectField, \
    SelectMultipleField
from web.form.fields.custom import UserIDField, MacField
from flask_wtf import FlaskForm as Form

from web.form.fields.validators import MacAddress


class HostForm(SelectRoomForm):
    owner_id = UserIDField("Besitzer-ID")
    name = TextField("Name", validators=[Optional()],
                     description="z.B. TP-LINK WR841, FritzBox 4040 oder MacBook")

    _order = ("name", "owner_id")


class InterfaceForm(Form):
    name = TextField("Name",
                     description="z.B. eth0, en0 oder enp0s29u1u1u5",
                     validators=[Optional()])
    mac = MacField("MAC", [MacAddress(message="MAC ist ungültig!")])
    ips = SelectMultipleField(u"IPs", validators=[Optional()])

Make interface name optional and remove unicode prefixes
Make interface name optional and remove unicode prefixes


  from wtforms.validators import DataRequired, Optional
  
  from web.blueprints.facilities.forms import SelectRoomForm
  from web.form.fields.core import TextField, QuerySelectField, \
      SelectMultipleField
  from web.form.fields.custom import UserIDField, MacField
  from flask_wtf import FlaskForm as Form
  
  from web.form.fields.validators import MacAddress
  
  
  class HostForm(SelectRoomForm):
-     owner_id = UserIDField(u"Besitzer-ID")
+     owner_id = UserIDField("Besitzer-ID")
-     name = TextField(u"Name", validators=[Optional()],
+     name = TextField("Name", validators=[Optional()],
-                      description=u"z.B. TP-LINK WR841, FritzBox 4040 oder MacBook")
+                      description="z.B. TP-LINK WR841, FritzBox 4040 oder MacBook")
  
      _order = ("name", "owner_id")
  
  
  class InterfaceForm(Form):
-     name = TextField(u"Name",description=u"z.B. eth0, en0 oder enp0s29u1u1u5")
+     name = TextField("Name",
+                      description="z.B. eth0, en0 oder enp0s29u1u1u5",
+                      validators=[Optional()])
-     mac = MacField(u"MAC", [MacAddress(message=u"MAC ist ungültig!")])
+     mac = MacField("MAC", [MacAddress(message="MAC ist ungültig!")])
      ips = SelectMultipleField(u"IPs", validators=[Optional()])
  
Make interface name optional and remove unicode prefixes
## Code Before:
from wtforms.validators import DataRequired, Optional

from web.blueprints.facilities.forms import SelectRoomForm
from web.form.fields.core import TextField, QuerySelectField, \
    SelectMultipleField
from web.form.fields.custom import UserIDField, MacField
from flask_wtf import FlaskForm as Form

from web.form.fields.validators import MacAddress


class HostForm(SelectRoomForm):
    owner_id = UserIDField(u"Besitzer-ID")
    name = TextField(u"Name", validators=[Optional()],
                     description=u"z.B. TP-LINK WR841, FritzBox 4040 oder MacBook")

    _order = ("name", "owner_id")


class InterfaceForm(Form):
    name = TextField(u"Name",description=u"z.B. eth0, en0 oder enp0s29u1u1u5")
    mac = MacField(u"MAC", [MacAddress(message=u"MAC ist ungültig!")])
    ips = SelectMultipleField(u"IPs", validators=[Optional()])

## Instruction:
Make interface name optional and remove unicode prefixes
## Code After:
from wtforms.validators import DataRequired, Optional

from web.blueprints.facilities.forms import SelectRoomForm
from web.form.fields.core import TextField, QuerySelectField, \
    SelectMultipleField
from web.form.fields.custom import UserIDField, MacField
from flask_wtf import FlaskForm as Form

from web.form.fields.validators import MacAddress


class HostForm(SelectRoomForm):
    owner_id = UserIDField("Besitzer-ID")
    name = TextField("Name", validators=[Optional()],
                     description="z.B. TP-LINK WR841, FritzBox 4040 oder MacBook")

    _order = ("name", "owner_id")


class InterfaceForm(Form):
    name = TextField("Name",
                     description="z.B. eth0, en0 oder enp0s29u1u1u5",
                     validators=[Optional()])
    mac = MacField("MAC", [MacAddress(message="MAC ist ungültig!")])
    ips = SelectMultipleField(u"IPs", validators=[Optional()])
