Get model fields
775058
def get_fields(cls, inlcude_base=False, include_id=False):
        """"""
        for field in cls._meta.fields:
            if field.name == 'deleted':
                continue
            if not include_id and field.name == 'id':
                continue
            if not inlcude_base and field.name in ['created_at', 'updated_at']:
                continue
            yield field
304251
def get_real_field(model, field_name):
    '''
    
    '''
    parts = field_name.split('__')
    field = model._meta.get_field(parts[0])
    if len(parts) == 1:
        return model._meta.get_field(field_name)
    elif isinstance(field, models.ForeignKey):
        return get_real_field(field.rel.to, '__'.join(parts[1:]))
    else:
        raise Exception('Unhandled field: %s' % field_name)
16728
def get_custom_fields(self):
        
        return CustomField.objects.filter(
            content_type=ContentType.objects.get_for_model(self))
1038405
def _get_fields_for_model(model):
    
    fields = []
    for name in model._sa_class_manager:
        prop = getattr(model, name)
        if isinstance(prop.property, RelationshipProperty):
            for pk in prop.property.mapper.primary_key:
                fields.append('{0}.{1}'.format(name, pk.name))
        else:
            fields.append(name)
    return tuple(fields)
846033
def get_nested_fields(schema, model_field=False):
    

    nested_fields = []
    for (key, value) in schema._declared_fields.items():
        if isinstance(value, List) and isinstance(value.container, Nested):
            nested_fields.append(key)
        elif isinstance(value, Nested):
            nested_fields.append(key)

    if model_field is True:
        nested_fields = [get_model_field(schema, key) for key in nested_fields]

    return nested_fields
996635
def _get_local_fields(self, model):
        ""
        local = [f for f in model._meta.fields]
        m2m = [f for f in model._meta.many_to_many]
        fields = local + m2m
        names = tuple([x.name for x in fields])

        return {
            ':local': dict(list(zip(names, fields))),
        }
873151
def get_model_field(schema, field):
    
    if schema._declared_fields.get(field) is None:
        raise Exception("{} has no attribute {}".format(schema.__name__, field))

    if schema._declared_fields[field].attribute is not None:
        return schema._declared_fields[field].attribute
    return field
416952
def bind_fields_to_model_cls(cls, model_fields):
        """"""
        return dict(
            (field.name, field.bind_model_cls(cls)) for field in model_fields)
625222
public function getFields()
    {
        $models = array();

        /**
         * @var Form_Field $form_field
         * @var Field $model_field
         */
        foreach ($this->field_associations as $form_field => $model_field) {
            $v = $this->form->get($form_field);
            $model_field->set($v);
            if (!isset($models[$model_field->owner->name])) {
                $models[$model_field->owner->name] = $model_field->owner;
            }
        }

        return $models;
    }
67771
def _get_field_by_name(model_class, field_name):
    
    field = model_class._meta.get_field(field_name)
    return (
        field,                                       # field
        field.model,                                 # model
        not field.auto_created or field.concrete,    # direct
        field.many_to_many                           # m2m
    )
1110739
def get_default_field_names(self, declared_fields, model_info):
        
        return (
            [self.url_field_name] +
            list(declared_fields.keys()) +
            list(model_info.fields.keys()) +
            list(model_info.forward_relations.keys())
        )
1081689
def get_model_field(model, field_name):
    
    meta = model._meta
    try:
        if DJANGO19:
            field = meta.get_field(field_name)
        else:
            field = meta.get_field_by_name(field_name)[0]
        return field
    except:
        if DJANGO19:
            related_objs = (
                f for f in meta.get_fields()
                if (f.one_to_many or f.one_to_one)
                and f.auto_created and not f.concrete
            )
            related_m2m_objs = (
                f for f in meta.get_fields(include_hidden=True)
                if f.many_to_many and f.auto_created
            )
        else:
            related_objs = meta.get_all_related_objects()
            related_m2m_objs = meta.get_all_related_many_to_many_objects()

        related_objects = {
            o.get_accessor_name(): o
            for o in chain(related_objs, related_m2m_objs)
        }
        if field_name in related_objects:
            return related_objects[field_name]
        else:
            # check virtual fields (1.7)
            if hasattr(meta, 'virtual_fields'):
                for field in meta.virtual_fields:
                    if field.name == field_name:
                        return field

            raise AttributeError(
                '%s is not a valid field for %s' % (field_name, model)
            )
1363957
def get_field_from_model_by_name(model_class, field_name):
    
    return first_match(lambda x: x if x.name == field_name else None, model_class._meta.fields)
333169
def model_fields(model, allow_pk=False, only=None, exclude=None,
                 field_args=None, converter=None):
    
    converter = converter or ModelConverter()
    field_args = field_args or {}

    model_fields = list(model._meta.sorted_fields)
    if not allow_pk:
        model_fields.pop(0)

    if only:
        model_fields = [x for x in model_fields if x.name in only]
    elif exclude:
        model_fields = [x for x in model_fields if x.name not in exclude]

    field_dict = {}
    for model_field in model_fields:
        name, field = converter.convert(
            model,
            model_field,
            field_args.get(model_field.name))
        field_dict[name] = field

    return field_dict
911637
def get_index_fields(self):
        
        index_fields = self.get_meta_option('index', [])
        if index_fields:
            return index_fields

        model = getattr(self.model_serializer_meta, 'model', None)
        if model:
            pk_name = model._meta.pk.name
            if pk_name in self.child.get_fields():
                return [pk_name]

        return []
416144
def getFields(cls) :
		""""""
		s = set(cls.columns.keys())
		s.remove('json')
		s.remove('raba_id')
		return s
440510
def get_fieldsets(self, request, obj=None):
        
        fieldsets = super(BaseDynamicInlineAdmin, self).get_fieldsets(
                                                            request, obj)
        if issubclass(self.model, Orderable):
            for fieldset in fieldsets:
                fields = [f for f in list(fieldset[1]["fields"])
                          if not hasattr(f, "translated_field")]
                try:
                    fields.remove("_order")
                except ValueError:
                    pass
                fieldset[1]["fields"] = fields
            fieldsets[-1][1]["fields"].append("_order")
        return fieldsets