[Fixed]-Django: Print out all choices for a models.Model class

1👍

Have a look at the meta options documentation. You can achieve this in the following way:

fields = SomeModel._meta.fields()
for field in fields:
    if field.choices:
        print "%s: %s" % (field.name, field.choices)
👤NS0

Leave a comment