factory_boy
factory_boy copied to clipboard
GenericForeignKey recipe without DB access
The problem
The docs contain a recipe for using factory_boy with models that have a GenericForeignKey.
This works great for integration tests, but the ContentType.objects.get_for_model(o.content_object)) call requires database access, which in my unit tests is something I'd like to avoid.
Proposed solution
Could you suggest a similar recipe to the one I linked that doesn't involve any kind of db access?