Opened 19 years ago

Closed 12 years ago

#2169 closed defect (fixed)

"Please correct the error below." With No Shown Errors

Reported by: tyson@… 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 James Bennett, 19 years ago

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.

comment:2 by mir@…, 19 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 James Bennett, 19 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:4 by Adrian Holovaty, 19 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #289.

comment:5 by Tyson Tate <tyson@…>, 18 years ago

Resolution: duplicate
Status: closedreopened

#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:6 by Adrian Holovaty, 18 years ago

Resolution: duplicate
Status: reopenedclosed

Duplicate of #289.

comment:7 by anonymous, 13 years ago

Easy pickings: unset
UI/UX: unset

comment:8 by anonymous, 12 years ago

Resolution: duplicate
Status: closedreopened

comment:9 by anonymous, 12 years ago

Resolution: fixed
Status: reopenedclosed

comment:10 by anonymous, 12 years ago

Resolution: fixed
Status: closedreopened

comment:11 by anonymous, 12 years ago

Owner: changed from Adrian Holovaty to anonymous
Status: reopenednew

comment:12 by anonymous, 12 years ago

Status: newassigned

comment:13 by Claude Paroz, 12 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.
Back to Top