how to get a list of filed names from django models

フィンランド--

from myapp.models import MyModel

# Get the model's meta information
meta = MyModel._meta

# Get a list of field names
field_names = [field.name for field in meta.fields]

print(field_names)

Posted by cabc-1234