Category Archives: django

Lead astray by the symptom

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 … Continue reading

Posted in django | Leave a comment

Adding a session to a Django request generated by RequestFactory

The Django RequestFactory is a useful tool for writing unit tests against Django views. I was using it to test some code that interacts with Cartridge, and ran into trouble because the RequestFactory doesn’t annotate request objects with Session objects, which … Continue reading

Posted in django | Tagged | 6 Comments