Returns a django.forms.Field instance for this database Field.
439405
def formfield(self, form_class=None, choices_form_class=None, **kwargs):
        
        defaults = {
            'required': not self.blank,
            'label': capfirst(self.verbose_name),
            'help_text': self.help_text,
        }
        if self.has_default():
            if callable(self.default):
                defaults['initial'] = self.default
                defaults['show_hidden_initial'] = True
            else:
                defaults['initial'] = self.get_default()

        include_blank = (self.blank
                         or not (self.has_default()
                                 or 'initial' in kwargs))

        choices = [BLANK_CHOICE_DASH, ] if include_blank else []
        choices.extend([
            (
                x.name,
                getattr(x, 'verbose_name', x.name) or x.name,
                getattr(x, 'help_text', None) or None
            )
            for x in self.choices_class.constants()
        ])

        defaults['choices'] = choices
        defaults['coerce'] = self.to_python

        if self.null:
            defaults['empty_value'] = None

        # Many of the subclass-specific formfield arguments (min_value,
        # max_value) don't apply for choice fields, so be sure to only pass
        # the values that TypedChoiceField will understand.
        for k in list(kwargs):
            if k not in ('coerce', 'empty_value', 'choices', 'required',
                         'widget', 'label', 'initial', 'help_text',
                         'error_messages', 'show_hidden_initial'):
                del kwargs[k]

        defaults.update(kwargs)
        form_class = choices_form_class or ChoicesFormField
        return form_class(**defaults)
286544
def _get_prepped_model_field(model_obj, field):
    

    # Get the field
    field = model_obj._meta.get_field(field)

    # Get the value
    value = field.get_db_prep_save(getattr(model_obj, field.attname), connection)

    # Return the value
    return value
1084633
def get_field(self, name):
        """"""
        # We only make the wrappers here (lazily) to avoid creating a ton of objects needlessly.
        field = self._wrapped_fields.get(name)
        if field is None:
            is_fake = False
            field = self._get_internal_field_by_name(name)
            if field is None:
                # Might be a "fake" field in JSON
                is_fake = self._is_fake_field(name)
                if not is_fake:
                    raise AttributeError("No such field %s" % name)
            field = self._make_wrapped_field(name, field, is_fake=is_fake)
            self._wrapped_fields[name] = field
        return field
704199
def formfield(self, **kwargs):
        """"""
        defaults = {
            'form_class': LocalizedIntegerFieldForm
        }

        defaults.update(kwargs)
        return super().formfield(**defaults)
987879
public static Field getField(String fieldName, Object object) {
    return getField(fieldName, object.getClass());
  }
1178328
def get_instance(self, payload):
        
        return FieldInstance(
            self._version,
            payload,
            assistant_sid=self._solution['assistant_sid'],
            task_sid=self._solution['task_sid'],
        )
711843
def make_localised_form(model, form, exclude=None):
    
    
    newfields = {}  
    
    for localized_field in model.localized_fields:
        # get the descriptor, which contains the form field
        default_field_descriptor = getattr(model, localized_field)
        
        # See if we've got overridden fields in a custom form.
        if hasattr(form, 'declared_fields'):
            form_field = form.declared_fields.get(
                localized_field, default_field_descriptor.form_field)
        else:
            form_field = default_field_descriptor.form_field
         
        # wrap the widget to show the origin of the value;
        # either database, catalog or fallback.
        if type(form_field.widget) is not WidgetWrapper:
            form_field.widget = WidgetWrapper(form_field.widget)
         
        newfields[localized_field] = form_field
 
    if hasattr(form, 'Meta'):
         setattr(form.Meta, 'model', model)
    else:
         newfields['Meta'] = type('Meta', tuple(), {'model':model})
    
    newfields['localized_fields'] = model.localized_fields
    
    return ModelFormMetaclass(model.__name__, (LocalisedForm, form), newfields)
1328191
def get_formset_class(self, **kwargs):
        
        form_class = self.get_formset_form_class()
        if form_class:
            kwargs['formfield_callback'] = self.formfield_for_dbfield
            return model_forms.modelformset_factory(self.model,
                        form_class, fields=self.change_fields, extra=0,
                        **kwargs)
46243
def get_instance_field(self, field_name):
        
        try:
            field = super(ModelWithDynamicFieldMixin, self).get_instance_field(field_name)
        except AttributeError:
            # the "has_field" returned True but getattr raised... we have a DynamicField
            dynamic_field = self._get_dynamic_field_for(field_name)  # it's a model bound field
            dynamic_field = self.get_field(dynamic_field.name)  # we now have an instance bound field
            field = self._add_dynamic_field_to_instance(dynamic_field, field_name)

        return field
1018617
def field(self):
        
        if not self.__field:
            default_field = inflection.underscore(self.__name)
            if isinstance(self, orb.ReferenceColumn):
                default_field += '_id'
            self.__field = default_field

        return self.__field or default_field
457103
def get_model_by_field(self, name):
        
        try:
            return self._fields_to_model[name]
        except KeyError:
            raise FieldError("Translated field does not exist: '{0}'".format(name))
943610
def get_fk_widget(cls, field):
        
        return functools.partial(
            widgets.ForeignKeyWidget,
            model=get_related_model(field))
1011400
def formfield_for_dbfield(self, db_field, **kwargs):
        
        overrides = self.formfield_overrides.get(db_field.name)
        if overrides:
            kwargs.update(overrides)

        field = super(AbstractEntryBaseAdmin, self).formfield_for_dbfield(db_field, **kwargs)

        # Pass user to the form.
        if db_field.name == 'author':
            field.user = kwargs['request'].user
        return field
1314930
def saveform(cls, form):
        

        columns = dict()
        for name, field in cls.form_fields.iteritems():
            columns[name] = getattr(form, field).data
        instance = cls(**columns)
        return instance.save()
1081037
def get_model_custom_fields(self):
        
        return CustomField.objects.filter(
            content_type=ContentType.objects.get_for_model(self))
459395
public BaseField getField(String strFieldName)    // Lookup this field
    {
        int iDotIndex = strFieldName.indexOf('.');
        if (iDotIndex != -1)    // Is Field formated as: RecordName.FieldName?
            return this.getField(strFieldName.substring(0, iDotIndex), strFieldName.substring(iDotIndex+1, strFieldName.length()));
        else
            return (BaseField)super.getField(strFieldName);
    }
292642
def get_proxy_field(self, instance):
        
        proxy_object = self.get_proxy_object(instance)
        if not proxy_object:
            return None
        return proxy_object.getField(self.name)