graphene-django-cud icon indicating copy to clipboard operation
graphene-django-cud copied to clipboard

Add before_create_obj hook to BatchCreateMutation

Open hansegucker opened this issue 1 year ago • 4 comments

Advances #126

hansegucker avatar Apr 17 '24 16:04 hansegucker

@tOgg1 I would be glad to get some feedback.

hansegucker avatar Apr 22 '24 18:04 hansegucker

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

hansegucker avatar Apr 30 '24 10:04 hansegucker

@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

hansegucker avatar May 10 '24 13:05 hansegucker

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 avatar May 17 '24 04:05 tOgg1

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.

tOgg1 avatar May 26 '24 18:05 tOgg1

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

hansegucker avatar May 27 '24 08:05 hansegucker

Hi.

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

tOgg1 avatar May 30 '24 15:05 tOgg1

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.

hansegucker avatar Jun 02 '24 15:06 hansegucker

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

hansegucker avatar Jun 26 '24 18:06 hansegucker

@hansegucker v0.12.0 out today.

tOgg1 avatar Jul 03 '24 06:07 tOgg1