Django

Code

Ticket #2723 (assigned)

Opened 2 years ago

Last modified 1 month ago

yes/no option for BooleanField

Reported by: Gary Wilson <gary.wilson@gmail.com> Assigned to: shanx (accepted)
Component: Admin interface Version: newforms-admin
Keywords: nfa-someday, sprintdec01, sprint-pycon08 Cc:
Triage Stage: Ready for checkin Has patch: 1
Needs documentation: 0 Needs tests: 0
Patch needs improvement: 0

Description

It would be nice to have the same sort of yes/no dropdown/radio option for BooleanField? that NullBooleanField? does (without the "unknown" choice of course). I think there are instances where this sort of interface works better than a checkbox. Adrian likes the radio option. google groups thread.

Attachments

booleanwidget_radio.diff (1.8 kB) - added by dtulig on 12/01/07 19:16:59.
Adds a custom boolean field widget to the admin interface.
booleanwidget_radio_with_tests.2.diff (9.4 kB) - added by shanx on 03/17/08 16:22:24.
Improved patch with tests
booleanwidget_radio_with_tests.diff (9.4 kB) - added by shanx on 03/17/08 16:22:31.
Improved patch with tests

Change History

02/21/07 15:09:30 changed by Michael Radziej <mir@noris.de>

  • stage changed from Unreviewed to Design decision needed.

08/13/07 00:04:55 changed by anonymous

  • status changed from new to closed.
  • needs_better_patch set to 1.
  • component changed from Admin interface to django-admin.py.
  • version set to SVN.
  • needs_docs set to 1.
  • resolution set to invalid.

08/13/07 00:39:58 changed by ubernostrum

  • status changed from closed to reopened.
  • needs_better_patch deleted.
  • component changed from django-admin.py to Admin interface.
  • resolution deleted.
  • needs_docs deleted.

Reverting spam close.

10/26/07 17:32:34 changed by SmileyChris

  • stage changed from Design decision needed to Accepted.

Shouldn't be hard to do in newforms-admin. Adrian likes it. Let's promote to accepted.

12/01/07 19:16:59 changed by dtulig

  • attachment booleanwidget_radio.diff added.

Adds a custom boolean field widget to the admin interface.

12/01/07 19:17:37 changed by dtulig

  • keywords set to newforms-admin, sprintdec01.
  • owner changed from nobody to dtulig.
  • has_patch set to 1.
  • status changed from reopened to new.

03/17/08 11:14:57 changed by shanx

  • owner changed from dtulig to shanx.
  • status changed from new to assigned.

03/17/08 16:20:31 changed by shanx

  • keywords changed from newforms-admin, sprintdec01 to newforms-admin, sprintdec01, sprint-pycon08.
  • stage changed from Accepted to Ready for checkin.

See attached improved patch + unit test. Unit tests check out and have been run against sqlite (since there is no db specific things going on here I deemed that to be enough)

I've changed the naming to AdminBooleanSelectWidget? for the widget itself, to match the naming pattern of other widget.

The widget uses it's own RadioFieldRenderer?, this is done to enable the <ul> that will be rendered to use the css plainlist layout, otherwise both radioselects would be rendered with square bullets in front of them in the Admin.

Also added are tests to see whether the hooks in BaseModelAdmin? work (those that bind specific widgets to certain fields), to booleanfield is of course tested.

03/17/08 16:22:24 changed by shanx

  • attachment booleanwidget_radio_with_tests.2.diff added.

Improved patch with tests

03/17/08 16:22:31 changed by shanx

  • attachment booleanwidget_radio_with_tests.diff added.

Improved patch with tests

03/18/08 09:21:25 changed by mtredinnick

  • version changed from SVN to newforms-admin.

04/04/08 03:36:10 changed by anonymous

  • keywords changed from newforms-admin, sprintdec01, sprint-pycon08 to nfa-someday, sprintdec01, sprint-pycon08.

Add/Change #2723 (yes/no option for BooleanField)




Change Properties
Action