Occasional FieldError for a field that really does exist

2017-05-04 Thread Evan Heidtmann
Hello Django friends, My app, running in production with uwsgi, very occasionally will crash because of a FieldError on a (valid) reverse ForeignKey relationship field. Without any code changes, other requests will succeed. Tests that cover this code path always pass. The two models are

How to delete a OneToOneField reverse relation?

2015-12-19 Thread Evan Heidtmann
My question is very similar to one by Seth Gordon in 2011. But it's been 4 years since then, so I'll try again. I have models A and B, and B has a O2O field pointing to A. When I do `a.b.delete()`, then I'm surprised to find that `a.b` is still a valid object. How can I modify `a` so that it