Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RelatedObjectDoesNotExist #25

Open
mverleg opened this issue Feb 26, 2018 · 0 comments
Open

RelatedObjectDoesNotExist #25

mverleg opened this issue Feb 26, 2018 · 0 comments

Comments

@mverleg
Copy link

mverleg commented Feb 26, 2018

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant