Django form을 초기화하고 기본값을 설정할 때 기존 모델 객체의 값을 사용할 수 있다.
model_to_dict으로 모델 객체를 dict으로 변환하고, initial 인자로 전달해 기본값 설정 가능
예제
from django.forms import model_to_dict
from example.models import Example
# 모델의 첫 번째 인스턴스 가져오기
example = Exampel.objects.get(pk=1)# dict으로 변환 후 example_dict에 할
example_dict = model_to_dict(example)