[Answer]-Getting model default value from modelForm in django

1👍

In your for loop, you can access the default value using initial attribute of field_value.

def setAttrs(object):
    for field_key,field_value in object.fields.items():
        print field_value.initial

Above will print initial/default value of each field.

👤Rohan

Leave a comment