Opened 18 years ago
Closed 12 years ago
#2169 closed defect (fixed)
"Please correct the error below." With No Shown Errors
Reported by: | Owned by: | anonymous | |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When a class has a field that isn't shown in the admin interface but must not be blank, it's impossible to add a new one. You get a cryptic "Please correct the error below." message with no shown errors. The error message should probably say something about a hidden field.
Here's a sample model to reproduce this bug:
class Foo(models.Model): title = models.CharField(maxlength=100) url = models.URLField() class Admin: fields = ( (None, {'fields': ('title',)}), )
Change History (13)
comment:1 by , 18 years ago
comment:2 by , 18 years ago
Hmm, I'd consider this an error in the model. manage.py validate
could throw an error when there are required fields that are not in the Admin.fields list..
comment:3 by , 18 years ago
That would solve it for the admin, but not for pages generated from a manipulator, which may include all the required fields in the manipulator, or might not show all those fields in the template; in that case, there would once again be an error with no apparent error message.
comment:5 by , 18 years ago
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
#289 was closed because Adrian didn't like the patch (I think - he didn't really leave an explanation on the "wontfix" change). I don't think this should be closed if it hasn't been fixed. Please let me know if I'm in the wrong here, but I really feel telling people there's an error without telling them where is like saying "There's a fire someplace on Earth, go put it out!"
comment:7 by , 13 years ago
Easy pickings: | unset |
---|---|
UI/UX: | unset |
comment:8 by , 12 years ago
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
comment:9 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:10 by , 12 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:11 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
comment:12 by , 12 years ago
Status: | new → assigned |
---|
comment:13 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The problem with solving this is in the way Django decouples its components. For the manipulator system (which is where the error message comes from) to know that a field was left blank because it wasn't ever shown in a page, the manipulator would effectively have to know the contents of the template which was rendered for the previous request, and there's simply no way for it to know that -- not only are manipulators decoupled from the template system, HTTP itself is stateless, so solving this completely would invlve the (IMHO) too-extreme step of trying to store information about the previous request in the session.
It may end up being that the only solution we can offer is a clear warning to make sure you have the admin display all of your required fields, and add an item to the "common pitfalls" section of the wiki about this if it's not there already.