Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Reset sequence on an abstract factory #103
Hi, thanks for maintaining this package, I find it really useful!
I have an issue where I try to share a Sequence between two otherwise unrelated Factories and set the shared Sequence to a specific start value.
My setup of factories is in this gist
The two factories should not inherit from each other, as they have no common attributes apart from the one that should be the Sequence. So I decided to make an abstract Factory with just that Sequence attribute and have both non-abstract Factories inherit from it.
Now, I want the Sequence to start from a particular value, so I'm calling
Apparently, the error occurs because Factory Boy is trying to initialize the Sequence to the highest PK, which of course fails for an abstract Factory which has no associated model. But, I want the Sequence to be initialized to the value I pass in reset_sequence() anyway.