admin.ModelAdmin.get_changeform_initial_data()

ModelAdmin.get_changeform_initial_data(request) [source]

A hook for the initial data on admin change forms. By default, fields are given initial values from GET parameters. For instance, ?name=initial_value will set the name field’s initial value to be initial_value.

This method should return a dictionary in the form {'fieldname': 'fieldval'}:

def get_changeform_initial_data(self, request):
    return {'name': 'custom_initial_value'}
doc_Django
2016-10-09 18:33:42
Comments
Leave a Comment

Please login to continue.