Code

Opened 6 years ago

Closed 3 months ago

#8579 closed New feature (fixed)

Move admin validation to only run as part of "validate" management command

Reported by: mtredinnick Owned by: nobody
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Normal practice within Django is that validation code is only run when requested, since code is correct more often than it is wrong. The admin validation code runs every time a URL conf file is imported and DEBUG = True. It should be moved to be part of the django-admin.py validate run.

This isn't entirely trivial, since it's a bit tied up with admin registration and that's an issue when admin.autodiscover() is used.

Attachments (0)

Change History (6)

comment:1 Changed 6 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 3 years ago by ramiro

  • Triage Stage changed from Accepted to Design decision needed

The intention is is noble, but one issue I see with the proposal is that this would tie a core management command to a contrib app. Maybe the validation management command can be given some more generic mechanism third party apps can hook into to run their own out off-line, one time validation processes?

comment:3 Changed 3 years ago by russellm

  • Triage Stage changed from Design decision needed to Accepted

@ramiro - I'm pretty sure that's what Malcolm would have been accepting. ./manage.py validate at the moment is a nest of isinstance checks and other special cases. It *should* be something that anyone field, model or app can hook into in a reliable way.

comment:4 Changed 3 years ago by lukeplant

  • Severity set to Normal
  • Type set to New feature

comment:5 Changed 3 years ago by carljm

  • Easy pickings unset
  • UI/UX unset

This ticket has been referenced (e.g. https://code.djangoproject.com/ticket/16283#comment:7) as the ticket for making validation extensible, but really its a more specific thing that blocks on extensible validation. I could edit the title and description to broaden this ticket, but I don't want to lose the specific piece of moving admin validation, which can be done in a separate commit after we have extensible validation.

So I'm going to leave #16905 open as the ticket for extensible validation, and just note here that this (as well as #3055) blocks on #16905.

comment:6 Changed 3 months ago by Russell Keith-Magee <russell@…>

  • Resolution set to fixed
  • Status changed from new to closed

In d818e0c9b2b88276cc499974f9eee893170bf0a8:

Fixed #16905 -- Added extensible checks (nee validation) framework

This is the result of Christopher Medrela's 2013 Summer of Code project.

Thanks also to Preston Holmes, Tim Graham, Anssi Kääriäinen, Florian
Apolloner, and Alex Gaynor for review notes along the way.

Also: Fixes #8579, fixes #3055, fixes #19844.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.