I have a Django admin form. And now I want to fill it\'s initial field with data based on my model. So I tried this:
class OrderForm(forms.ModelForm): cl
This code is worked for me (Django 1.11):
from django import forms class MyAdminForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.initial['field_name'] = 'initial_value'