Opened 11 years ago
Closed 11 years ago
#21744 closed Uncategorized (invalid)
Dinamic creation of forms.ImageField
Description ¶
I have a problem with the forms.ImagaField. The problem is , that I want to set initial value to this fieled dynamically , and then widget ClearableFileInput will display the "Current link" and checkbox.I read somewhere, that i have to pass "dictionary File" with attribute "url", and then the widget will know to display it. But i don't know , how pass it properly.
if attr.type == "Img":
self.fields [title] = forms.ImageField (required = bool (required))
Where here, i have to assign an initial value.
Thank you.
Please see https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels -- thanks!