We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'd like to pass an argument which is not part of the model, but used in the post_create method to create another object
post_create
Params
self.params.xxx
class MyFactory(factory.django.DjangoModelFactory): class Meta: model = MyModel class Params: with_reminder = False first_name = factory.Faker("first_name") last_name = factory.Faker("last_name") def post_create(self, create, extracted, **kwargs): if create and self.params.with_reminder: Reminder.objects.create(related_object=self) MyFactory() # no reminder MyFactory(with_reminder=True)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The problem
I'd like to pass an argument which is not part of the model, but used in the
post_create
method to create another objectProposed solution
Params
and make this available, e.g.self.params.xxx
Example
The text was updated successfully, but these errors were encountered: