示例#1
0
 def __init__(self, **kwargs):
     """Initialize requirements field."""
     kwargs.setdefault("icon", "icon-laptop")
     if 'choices' not in kwargs:
         requirements_filter = {}
         for opt in ['domain_flavor', 'domain_os']:
             if opt in kwargs:
                 requirements_filter[opt] = kwargs[opt]
                 del kwargs[opt]
         kwargs['choices'] = _kb_requirements_choices(**requirements_filter)
     kwargs['processors'] = [set_flag('touched'), ]
     super(RequirementsField, self).__init__(**kwargs)
示例#2
0
    def __init__(self, **kwargs):
        """Initialize license field."""
        kwargs.setdefault("icon", "icon-certificate")

        if 'choices' not in kwargs:
            license_filter = {}
            for opt in ['domain_data', 'domain_content', 'domain_software']:
                if opt in kwargs:
                    license_filter[opt] = kwargs[opt]
                    del kwargs[opt]
            kwargs['choices'] = _kb_license_choices(**license_filter)
        kwargs['processors'] = [set_flag('touched'), ]
        super(LicenseField, self).__init__(**kwargs)
示例#3
0
    def __init__(self, **kwargs):
        """Initialize instruments field."""
        kwargs.setdefault("icon", "icon-certificate")

        if "choices" not in kwargs:
            # current_app.logger.debug('Obtengo los instrumentos')
            instruments = getAllInstruments()
            # current_app.logger.debug('Hecho')
            instruments_json = json.loads(instruments)
            # current_app.logger.debug('Cargo json')
            # current_app.logger.debug(instruments_json)
            choices = [("-1", "Select an instruments")]
            for instrument in instruments_json:
                choices.append((str(instrument["idInstrument"]), str(instrument["name"])))

            kwargs["choices"] = choices
        kwargs["processors"] = [set_flag("touched"), instrument_processor]
        super(InstrumentField, self).__init__(**kwargs)
示例#4
0
    def __init__(self, **kwargs):
        """Initialize instruments field."""
        kwargs.setdefault("icon", "icon-certificate")

        if 'choices' not in kwargs:
            #current_app.logger.debug('Obtengo los instrumentos')
            instruments = getAllInstruments()
            #current_app.logger.debug('Hecho')
            instruments_json = json.loads(instruments)
            #current_app.logger.debug('Cargo json')
            #current_app.logger.debug(instruments_json)
            choices = [("-1", 'Select an instruments')]
            for instrument in instruments_json:
                choices.append(
                    (str(instrument['idInstrument']), str(instrument['name'])))

            kwargs['choices'] = choices
        kwargs['processors'] = [
            set_flag('touched'),
            instrument_processor,
        ]
        super(InstrumentField, self).__init__(**kwargs)