I django, I can access the value of a field in a ModelForm by using the “initial” keyword.
I have no idea why, or what it is. Is it only used for accessing the value when i want to initialise it? Are there times when I cannot use the “initial” keyword?
I guess I’m asking this because ‘initial’ implies, well, initialising a value.
Apparently after calling “save” on a form I cannot change any values – but does that mean I can use “initial” willy nilly before then?
These should help:
https://docs.djangoproject.com/en/dev/ref/forms/fields/#initial
https://docs.djangoproject.com/en/dev/ref/forms/api/#dynamic-initial-values
It’s a place to stick initial field values that you want the fields populated with when the page loads. You probably want to put things into initial during a get, and not mess with it during a post.