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

Fix broken form.save() call in DjangoFormMutation.perform_mutate #1155

Merged
merged 1 commit into from
Apr 11, 2021
Merged

Fix broken form.save() call in DjangoFormMutation.perform_mutate #1155

merged 1 commit into from
Apr 11, 2021

Conversation

ruohola
Copy link
Contributor

@ruohola ruohola commented Apr 5, 2021

Django's plain (non-model) forms don't have the save method, so
calling this would just result in an AttributeError before this
change.

Resolves #1152


Didn't want to just remove the form.save() line completely, since the tests at least "document" it as a valid usage to pass a ModelForm as the form_class of a plain DjangoFormMutation:

class PetFormMutation(DjangoFormMutation):
class Meta:
form_class = PetForm

(PetForm is a forms.ModelForm here)

@ruohola ruohola changed the title Remove broken form.save() call from DjangoFormMutation.perform_mutate Fix broken form.save() call in DjangoFormMutation.perform_mutate Apr 5, 2021
@ruohola ruohola changed the title Fix broken form.save() call in DjangoFormMutation.perform_mutate Fix broken form.save() call in DjangoFormMutation.perform_mutate Apr 5, 2021
Django's plain (non-model) forms don't have the `save` method, so
calling this would just result in an `AttributeError` before this
change.

Resolves #1152
Copy link
Collaborator

@zbyte64 zbyte64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 seems sensible to me

@zbyte64 zbyte64 merged commit 608af57 into graphql-python:main Apr 11, 2021
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

Successfully merging this pull request may close these issues.

Why DjangoFormMutation.perform_mutate() calls form.save()
2 participants