def __init__(self, *args, **kwargs): super(ImageSetItemLinkInlineForm, self).__init__(*args, **kwargs) if self.instance.pk is not None and self.instance.destination_content_type: destination_content_type = self.instance.destination_content_type.model_class() else: destination_content_type = None self.fields['destination_object_id'].widget = fk_lookup.GenericFkLookup('id_%s-destination_content_type' % self.prefix, destination_content_type) self.fields['destination_content_type'].widget.choices = schema.content_type_choices()
def __init__(self, *args, **kwargs): super(ObjectLinkInlineForm, self).__init__(*args, **kwargs) if self.instance.pk is not None: if self.instance.destination_content_type: destination_content_type = self.instance.destination_content_type.model_class() else: destination_content_type = None #self.fields['destination_object_id'].widget = GenericForeignKeySearchInput(LINK_SCHEMA, 'id_%s-destination_content_type' % self.prefix, destination_content_type) self.fields['destination_object_id'].widget = fk_lookup.GenericFkLookup('id_%s-destination_content_type' % self.prefix, destination_content_type) self.fields['destination_content_type'].widget.choices = schema.content_type_choices()
def __init__(self, *args, **kwargs): super(ImageSetItemPluginForm, self).__init__(*args, **kwargs) if self.instance.pk is not None and self.instance.destination_content_type: destination_content_type = self.instance.destination_content_type.model_class( ) else: destination_content_type = None self.fields[ 'destination_object_id'].widget = fk_lookup.GenericFkLookup( 'id_%s-destination_content_type' % self.prefix, destination_content_type) self.fields[ 'destination_content_type'].widget.choices = schema.content_type_choices( )
def __init__(self, *args, **kwargs): super(LinkItemForm, self).__init__(*args, **kwargs) if self.instance.pk is not None: # has already been saved()? if self.instance.destination_content_type: destination_content_type = self.instance.destination_content_type.model_class() else: destination_content_type = None # look up the correct widget from the content type widget = fk_lookup.GenericFkLookup( 'id_%s-destination_content_type' % self.prefix, destination_content_type, ) self.fields['destination_object_id'].widget = widget self.fields['destination_content_type'].widget.choices = schema.content_type_choices()
def __init__(self, *args, **kwargs): super(ObjectLinkInlineForm, self).__init__(*args, **kwargs) if self.instance.pk is not None: if self.instance.destination_content_type: destination_content_type = self.instance.destination_content_type.model_class( ) else: destination_content_type = None #self.fields['destination_object_id'].widget = GenericForeignKeySearchInput(LINK_SCHEMA, 'id_%s-destination_content_type' % self.prefix, destination_content_type) self.fields[ 'destination_object_id'].widget = fk_lookup.GenericFkLookup( 'id_%s-destination_content_type' % self.prefix, destination_content_type) self.fields[ 'destination_content_type'].widget.choices = schema.content_type_choices( )