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 19126,Allow runserver to bypass model validation,Brendan Jurd,nobody,"I recently encountered a frustrating little issue in one of my apps. I wasn't able to run the development server because of a non-critical model validation failure. The error was '""ordering"" refers to ""split_code"", a field that doesn't exist.' In several of my models, ""ordering"" refers to a field which isn't part of the main model definition, but *is* added to the query set by a custom default Manager. So in practice (when I run it under mod_wsgi) the ordering works exactly as intended. This is a case where the model fails to validate, but actually works properly in a live-fire situation. Perhaps the model validation is too strict in this case, but I can understand why. It would probably be a lot of fuss to try to make it clever enough to detect additional fields that are pulled in by the queryset on the Manager. But there's a broader issue in that *any* model validation failure, no matter how unimportant, is enough to stop the development server from working with an ""Unhandled exception"" in 1.3.1. I think it's fine that I get a message about the ""ordering"" definition, but I don't think it should be a showstopper. There are few different ways to get past this. My suggestion would be that when executing ""runserver"", we should catch CommandErrors coming out of 'validate', report them, and then keep on trying to run the server anyway. I've included a patch along these lines. Other options include * teach 'validate' to recognise fields that are included by the default Manager's queryset, * teach 'validate' to differentiate between errors that are critical in nature, and those that really only need to be warnings, * allow SQL expressions in 'ordering', not just field names, so that the custom Manager field isn't necessary in the first place. ... but they all seem like a lot of effort. Thanks for your time. ",New feature,closed,Core (Management commands),dev,Normal,fixed,,,Accepted,1,0,0,0,0,0