awx/awx/main/utils/db.py
AlanCoding 1f46878652
Revert "Apply migration flag check to task manager"
This reverts commit a0910eb6de3c4713199e73c43f003c48c2895f9f.
2020-01-02 09:08:17 -05:00

17 lines
646 B
Python

# Copyright (c) 2017 Ansible by Red Hat
# All Rights Reserved.
from itertools import chain
def get_all_field_names(model):
# Implements compatibility with _meta.get_all_field_names
# See: https://docs.djangoproject.com/en/1.11/ref/models/meta/#migrating-from-the-old-api
return list(set(chain.from_iterable(
(field.name, field.attname) if hasattr(field, 'attname') else (field.name,)
for field in model._meta.get_fields()
# For complete backwards compatibility, you may want to exclude
# GenericForeignKey from the results.
if not (field.many_to_one and field.related_model is None)
)))