Is there any Django built-in function that return a list of all auto-generated fields from a Django model?
Something like: MyModel._meta._get_auto_generated_fields()
CodePudding user response:
You can filter the fields with list comprehension on the .auto_generated
attribute [Django-doc]:
[field for field in MyModel._meta.get_fields() if field.auto_created]