I was instantiating a Django subclass in a test, and it wasn’t setting one of the foreign key fields. We are subclassing an Order class, and was doing: OurOrder.objects.create(other=other)
When I retrieved the object from the database later, it wasn’t set. I was convinced it was some weirdness with multi-table inheritance. Turned out I had done other=Other(...)
instead of other=Other.objects.create(...)
, so there was no database entry. Whoops…