Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
        'polymorphic_identity': 'Object',
        'polymorphic_on': type
    }


ParentDevice = type(
    'CustomDevice', (Object, ), {
        '__tablename__': 'CustomDevice',
        'id': Column(Integer, ForeignKey('Object.id'), primary_key=True),
        '__mapper_args__': {
            'polymorphic_identity': 'CustomDevice'
        },
        **{
            property: Column(sql_types[values['type']],
                             default=values['default'])
            for property, values in custom_properties.items()
        }
    }) if custom_properties else Object


class Device(ParentDevice):

    __tablename__ = 'Device'

    id = Column(Integer, ForeignKey(ParentDevice.id), primary_key=True)
    operating_system = Column(String)
    os_version = Column(String)
    ip_address = Column(String)
    longitude = Column(Float)
    latitude = Column(Float)
    port = Column(Integer, default=22)
Ejemplo n.º 3
0
Archivo: forms.py Proyecto: fublu/eNMS
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)