id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 15494 Using only('pk') in related set raises FieldDoesNotExist anonymous Sam Thompson "This is my first ticket, apologies if this is known or I've missed something in my report. With model A and model B, where model B has a fk to A: >>> A().b_set.all().only('pk') Raises ""FieldDoesNotExist: B has no field named 'pk'"" In my example I'm instantiating a new object for brevity. The behaviour is the same with a saved object. I've attached a simple patch, however I couldn't get the testrunner working, so I couldn't write a full patch. Also, I expect this isn't the best method, but I don't know enough about the ORM to know of a better fix." Bug closed Database layer (models, ORM) 1.2 Normal fixed Accepted 1 0 1 1 0 0