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

Add before_create_obj hook to BatchCreateMutation #130

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

hansegucker
Copy link
Contributor

Advances #126

@hansegucker
Copy link
Contributor Author

@tOgg1 I would be glad to get some feedback.

@hansegucker
Copy link
Contributor Author

@tOgg1 Sorry to ping you again, but it would help us if we could use this feature.

@hansegucker
Copy link
Contributor Author

@tOgg1 Sorry to ping you again, but it would help us if we could use this feature.

Sorry to bother you again, but is there any chance to get this usable? @tOgg1

@tOgg1
Copy link
Owner

tOgg1 commented May 17, 2024

Hi @hansegucker.

Thank you for being patient. I will do a new round of updates and improvements on this library in the coming week. I'll make sure to fast-track this PR and the underlying issues.

@tOgg1
Copy link
Owner

tOgg1 commented May 26, 2024

Hi @hansegucker.

I've pulled your branch and done some initial testing. There is a single issue with the test test__one_to_one_relation_exists__creates_specified_fields which fails. It fails because the object is not saved until after the block adding one_to_one relations has run.

Moving the call to before_create_obj and adding another save there, seems to fix the issue:

obj = Model(**model_field_values)

cls.before_create_obj(info, input, obj)
obj.save()

# Handle one to one rels
if len(one_to_one_rels) > 0:

    ...

Please have a look at this. Could you also move the before_create_obj stub to the bottom of the DjangoCudBase class, alongside the other stubs?

When this is fixed the PR should be ready to be merged.

@hansegucker
Copy link
Contributor Author

Hey, thank you! I fixed the mentioned things and look forward to get this merged.

@tOgg1
Copy link
Owner

tOgg1 commented May 30, 2024

Hi.

The save is still in the wrong place. It needs to be above the line if len(one_to_one_rels) > 0:.

@hansegucker
Copy link
Contributor Author

Hi.

The save is still in the wrong place. It needs to be above the line if len(one_to_one_rels) > 0:.

Oh, sorry, I missed that. I hope that now everything is fine.

@tOgg1 tOgg1 merged commit 9d49c14 into tOgg1:develop Jun 6, 2024
6 checks passed
@hansegucker
Copy link
Contributor Author

@tOgg1 Can we get a release with this change? That would be super helpful.

@tOgg1
Copy link
Owner

tOgg1 commented Jul 3, 2024

@hansegucker v0.12.0 out today.

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.

2 participants