django-superform
django-superform copied to clipboard
RelatedObjectDoesNotExist
I have this form
class StudioAppointmentForm(SuperModelForm):
who = ForeignKeyFormField(form_class=CustomerForm, field_name='who', blank=True)
class Meta:
model = StudioAppointment
fields = ()
with a model
class StudioAppointmentForm(SuperModelForm):
who = ForeignKeyFormField(form_class=CustomerForm, field_name='who', blank=True)
class Meta:
model = StudioAppointment
fields = ()
But when I do
form = StudioAppointmentForm(request.POST or None)
I get
RelatedObjectDoesNotExist at /new/studio/
StudioAppointment has no who.
...
at .../django_superform/fields.py in get_instance
313. return getattr(form.instance, field_name)
StudioAppointment has a who field, but it's None because this is a new instance.
Am I doing something wrong?
Django Version: 2.0.2
Python version: 3.5.2