How to get list of model fields with Python Django?

To get list of model fields with Python Django, we use MyModel._meta.get_fields().

For instance, we write

[f.name for f in MyModel._meta.get_fields()]

to get all the fields with MyModel._meta.get_fields().

Then we get the name of each field with f.name.