class GottyConnectionForm(FlaskForm): address_choices = [("ip_address", "IP address"), ("name", "Name") ] + [(property, values["pretty_name"]) for property, values in custom_properties.items() if values.get("is_address", False)] address = SelectField(choices=address_choices)
vendor = Column(String(255)) CustomDevice: Any = (type( "CustomDevice", (Object, ), { "__tablename__": "CustomDevice", "__mapper_args__": { "polymorphic_identity": "CustomDevice" }, "id": Column(Integer, ForeignKey("Object.id"), primary_key=True), **{ property: Column(sql_types[values["type"]], default=values["default"]) for property, values in custom_properties.items() }, }, ) if custom_properties else Object) class Device(CustomDevice): __tablename__ = "Device" __mapper_args__ = {"polymorphic_identity": "Device"} class_type = "device" id = Column(Integer, ForeignKey(CustomDevice.id), primary_key=True) operating_system = Column(String(255)) os_version = Column(String(255)) ip_address = Column(String(255)) longitude = Column(Float)