Django

Code

Ticket #7771 (closed: fixed)

Opened 5 months ago

Last modified 5 months ago

New validator code breaks ordering of ForeignKey fields

Reported by: Michael P. Jung Assigned to: brosner
Milestone: 1.0 alpha Component: Uncategorized
Version: newforms-admin Keywords: ordering, order_by, ForeignKey, r7929
Cc: mpjung@terreon.de Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description (Last modified by ramiro)

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

  (...)
  File "django/contrib/admin/sites.py", line 81, in register
    validate(admin_class, model)
  File "django/contrib/admin/validation.py", line 84, in validate
    _check_field_existsw('ordering[%d]' % idx, field)
  File "django/contrib/admin/validation.py", line 25, in _check_field_existsw
    return _check_field_exists(cls, model, opts, label, field)
  File "django/contrib/admin/validation.py", 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`.

Attachments

Change History

07/15/08 19:30:30 changed by ramiro

  • needs_better_patch changed.
  • description changed.
  • needs_tests changed.
  • needs_docs changed.

07/15/08 19:32:52 changed by brosner

  • owner changed from nobody to brosner.
  • status changed from new to assigned.
  • stage changed from Unreviewed to Accepted.
  • milestone changed from 1.0 to 1.0 alpha.

07/15/08 20:02:57 changed by brosner

  • status changed from assigned to closed.
  • resolution set to fixed.

(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.


Add/Change #7771 (New validator code breaks ordering of ForeignKey fields)




Change Properties
Action