def get_all_field_names(model_meta):
    """Copied from django.db.models.options.Options.get_all_field_names
    replacing set() with list() to preserve field order"""

    # Using internal variable 'self' to be as similar as possible to original function
    self = model_meta
    names = list()
    fields = self.get_fields()
    for field in fields:
        # For backwards compatibility GenericForeignKey should not be
        # included in the results.
        if field.is_relation and field.many_to_one and field.related_model is None:
            continue
        # Relations to child proxy models should not be included.
        if (field.model != self.model and
                field.model._meta.concrete_model == self.concrete_model):
            continue

        if field.name in names:
            continue
        names.append(field.name)
        if hasattr(field, 'attname') and field.attname != field.name:
            names.append(field.attname)
    return names