Django Tests

There’s so much I could write about django in general, but right now I’d like to address an issue that I just ran into and found a quick solution to.

Using Model Bakery to create a new model (or really any ‘create’ action), custom save actions update the database, but not the model. The model that tests need to be run against needs to be refreshed.

Per this StackOverflow answer:

self.purchase_request = PurchaseRequest.objects.get(pk=self.purchase_request.pk)

Leave a Comment