google-code-export / django-mptt

Automatically exported from code.google.com/p/django-mptt
Other
0 stars 0 forks source link

TreeNodeChoiceField should allow non-selection #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Due to the line: 

kwargs['empty_label'] = None

a TreeNodeChoiceField (even with required = False) won't display an empty
top value in the select control to allow a non-selection... Modifying it to
allow user-override is trivial and allows me to use the control for when I
want to (optionally) insert things into a tree or leave unordered in the
admin...

See attached diff for following code in forms.py - 

if 'empty_label' not in kwargs:
  kwargs['empty_label'] = None

Original issue reported on code.google.com by sime...@gmail.com on 26 Feb 2009 at 8:54

Attachments:

GoogleCodeExporter commented 9 years ago
Merging this would save a lot of useless subclassing :)

Original comment by pan.piel...@gmail.com on 12 Mar 2009 at 9:49

GoogleCodeExporter commented 9 years ago

Original comment by jonathan.buchanan on 1 Jul 2009 at 2:41

GoogleCodeExporter commented 9 years ago
Hmm, that was a bit silly.

As of r120 and r121 TreeNodeChoiceField no longer wipes out empty_label if the 
field
is not required or if an empty_label was provided.

Original comment by jonathan.buchanan on 1 Jul 2009 at 3:18