3👍
fields = [f.attname for f in Experience._meta.fields]
file_fields = []
print("FILE FIELDS : ", fields)
for field in fields:
get_type = Experience._meta.get_field(field)
print("GET TYPE :", get_type)
field_type = get_type.__class__.__name__
print(field, "FILE TYPE : ", field_type)
if field_type == "FileField":
file_fields.append(field)
This code can get the field types of django models.
Source:stackexchange.com