#3683 (Cannot query "Eleonora ...": Must be "Client" instance.)
by Luc Saffre · in Developers · assigned to tonis
Summary
Children
Comments
- 6 years, 4 months ago by Luc Saffre about #3683 (Cannot query "Eleonora ...": Must be "Client" instance.) : We can put this ticket to sleep because avanti wants to extend the xl uploads plugin so that it works also in avanti, without the coachings plugin. The only thing to do here is that Lino should raise a reliable error message when a lookup refers to something that is not installed. But we will need t...
- 6 years, 4 months ago by Luc Saffre about #3683 (Cannot query "Eleonora ...": Must be "Client" instance.) : Yes, Lino (or Django) should warn more clearly about this kind of error, and we should explore why the error didn't repeat on the second request. But that's less urgent.
- 6 years, 4 months ago by Luc Saffre about #3683 (Cannot query "Eleonora ...": Must be "Client" instance.) : The explanation is rather easy : the uploads plugin in xl works only when the coachings plugin is also installed. Seems that this was a design flaw in avanti from the beginning. Solution will be simply to replace lino_xl.lib.uploads with lino.modlib.uploads in the get_installed_apps() in avanti. But...
- 6 years, 4 months ago by tonis about #3683 (Cannot query "Eleonora ...": Must be "Client" instance.) : Thinking perhaps the disappearing issue might be due to the table being empty? Maybe there's some subtle tricks of django that are not applying the filters to an empty QS... Doesn't make too much sense, but it's the best I got. Got my env working again and it's testable so tomorrow I'll do the same t...
- 6 years, 4 months ago by tonis about #3683 (Cannot query "Eleonora ...": Must be "Client" instance.) : Think I've hit something... The project field is actually pointing to the Client model. However the Client model doesn't seem to even have the related_name coachings_by_client. And if I pass in a client instance, I get the error: Related Field got invalid lookup: coachings_by_client Seems to be tha...
- 6 years, 4 months ago by Luc Saffre about #3683 (Cannot query "Eleonora ...": Must be "Client" instance.) : I wrote a doctest in [url luc.lino-framework.org/blog/2020/0610.html#cannot-query-eleonora-must-be-client-instance my blog] that reproduces the problem.
- 6 years, 4 months ago by tonis about #3683 (Cannot query "Eleonora ...": Must be "Client" instance.) : Very odd, after closing and refreshing table data it works. And still works after a refresh of the page. Happens again after restarting site. Analyzing request data... The request params are exactly same after a data refresh. Even if you edit and resend there's no error anymore... I guess best bet is...
- 6 years, 4 months ago by Luc Saffre about #3683 (Cannot query "Eleonora ...": Must be "Client" instance.) : Nice riddle. Uploads.coached_by is defined as a FK to users.User, so why does Django suddenly complain that it wants a Client instance instead? Smells as if it had to do with the default_params method. The problem is more than a month old, it occurs already on the current avanti production site (upg...