Opened 16 years ago
Closed 14 years ago
#7435 closed (fixed)
get_{next,previous}_by_someDateField() on unsaved objects should throw meaningfull error
Reported by: | Marc Fargas | Owned by: | Marc Fargas |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
As stated on this thread when you call self.get_{next,previous}_by_someDateField() on an unsaved object Django says something like:
"Cannot use None as a query"
The error could be something easier to understand like "Cannot query over an unsaved object".
Attachments (2)
Change History (7)
comment:1 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
by , 16 years ago
comment:2 by , 16 years ago
Has patch: | set |
---|
Done, that should give a nicer error message. Somebody with a bit more knowledge please check that my use of "self.pk" is correct.
No test have been written as this should need it's own test (from my POV), only pass those already there ;)
comment:3 by , 16 years ago
The docs-refactor broke the patch, always up-to-date patch here in colours and raw
comment:4 by , 16 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:5 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Patch.