Django

Code

Ticket #1697 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

[patch] magic-removal: the choices keyword for Fields is restricted

Reported by: brantley Assigned to: adrian
Milestone: Component: Core framework
Version: magic-removal Keywords: validate choices
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

The choices keyword is restricted to a list or tuple by the management.py, get_validation_errors(). It should instead allow anything that is iterable. For instance, a generator could then be used. I've attached a simple patch.

Attachments

iterable.diff (0.8 kB) - added by brantley on 04/26/06 13:31:33.
patch

Change History

04/26/06 13:31:33 changed by brantley

  • attachment iterable.diff added.

patch

04/26/06 17:59:37 changed by Christopher Lenz <cmlenz@gmx.de>

Note that (I think) this will also allow strings, which will result in a different behavior than the developer would probably expect.

04/27/06 15:06:34 changed by brantley

Yes, it would be allowed by the validation, but would not work as the system will expect two-tuples. But I'm not sure if validate should check each item of the iterable or what.

06/06/06 21:46:08 changed by adrian

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

(In [3094]) Fixed #1697 and #2095 -- Made 'choices' parameter accept any iterable


Add/Change #1697 ([patch] magic-removal: the choices keyword for Fields is restricted)




Change Properties
Action