Django: Get list of model fields?
Django versions 1.8 and later: You should use get_fields(): [f.name for f in MyModel._meta.get_fields()] The get_all_field_names() method is deprecated starting from Django 1.8 and will be removed in 1.10. The documentation page linked above provides a fully backwards-compatible implementation of get_all_field_names(), but for most purposes the previous example should work just fine. Django versions before … Read more