Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#7771 closed (fixed)

New validator code breaks ordering of ForeignKey fields

Reported by: Michael P. Jung Owned by: brosner
Component: Uncategorized Version: newforms-admin
Severity: Keywords: ordering, order_by, ForeignKey, r7929
Cc: mpjung@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by ramiro)

Revision 7929 adds a validator code that can't handle orderings like ('bar__name',):

  File "django/contrib/admin/", line 81, in register
    validate(admin_class, model)
  File "django/contrib/admin/", line 84, in validate
    _check_field_existsw('ordering[%d]' % idx, field)
  File "django/contrib/admin/", line 25, in _check_field_existsw
    return _check_field_exists(cls, model, opts, label, field)
  File "django/contrib/admin/", line 243, in _check_field_exists
    % (cls.__name__, label, field, model.__name__))
django.core.exceptions.ImproperlyConfigured: `Foo_Options.ordering[0]` refers to field `bar__name` that is missing from model `Foo`.

Change History (4)

comment:1 Changed 8 years ago by ramiro

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 8 years ago by brosner

  • milestone changed from 1.0 to 1.0 alpha
  • Owner changed from nobody to brosner
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 8 years ago by brosner

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

(In [7931]) newforms-admin: Fixed #7771 -- Improved the validation check on the ordering field. Now takes '?' and 'field1field2' syntax into consideration. Thanks Michael Jung for catching this.

comment:4 Changed 5 years ago by jacob

  • milestone 1.0 alpha deleted

Milestone 1.0 alpha deleted

Note: See TracTickets for help on using tickets.
Back to Top