(self, username, item, *args, **kwargs)
Initialize the form.
        Populates form fields based on context object (item) and its related
        items. The way the form fields are populated ensures that only
        STIXifyable / CybOXable options are provided.
Initialize the form.
        Populates form fields based on context object (item) and its related
        items. The way the form fields are populated ensures that only
        STIXifyable / CybOXable options are provided.
Initialize the form . Populates form fields based on context object ( item ) and its related items . The way the form fields are populated ensures that only STIXifyable / CybOXable options are provided .
def __init__(self, username, item, *args, **kwargs):
        """
        Initialize the form.
        Populates form fields based on context object (item) and its related
        items. The way the form fields are populated ensures that only
        STIXifyable / CybOXable options are provided.
        """
        kwargs.setdefault('label_suffix', ':')
        super(TAXIISendForm, self).__init__(*args, **kwargs)
        sc = get_config('taxii_service')
        user_srcs = user_sources(username)
        self.fields['rcpts'].choices = get_taxii_feeds(user_srcs)

        # populate all of the multi choice fields with valid options
        # from the context CRITs object's related items.
        for _type in get_supported_types():
            collected = collect_objects(item._meta['crits_type'], item.id,
                                        1, sc['max_rels'], sc['max_rels'],
                                        [_type], user_srcs, False)
            field = forms.MultipleChoiceField(required=False, label=_type)
            field.choices = filter_and_format_choices(collected, item, _type)
            self.fields[_type] = field
def __init__ ( self , username , item , * args , * * kwargs ) : kwargs . setdefault ( 'label_suffix' , ':' ) super ( TAXIISendForm , self ) . __init__ ( * args , * * kwargs ) sc = get_config ( 'taxii_service' ) user_srcs = user_sources ( username ) self . fields [ 'rcpts' ] . choices = get_taxii_feeds ( user_srcs ) # populate all of the multi choice fields with valid options # from the context CRITs object's related items. for _type in get_supported_types ( ) : collected = collect_objects ( item . _meta [ 'crits_type' ] , item . id , 1 , sc [ 'max_rels' ] , sc [ 'max_rels' ] , [ _type ] , user_srcs , False ) field = forms . MultipleChoiceField ( required = False , label = _type ) field . choices = filter_and_format_choices ( collected , item , _type ) self . fields [ _type ] = field