[damned-lies] Set required to False in __init__ for ReleaseField



commit d4e4857085c0867a4985532e783daaf3d987ff85
Author: Claude Paroz <claude 2xlibre net>
Date:   Thu Aug 6 21:42:25 2009 +0200

    Set required to False in __init__ for ReleaseField
    
    If required is True (default) in __init__ and the field has initial value,
    there is no empty label in dropdown list.

 stats/forms.py |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/stats/forms.py b/stats/forms.py
index 53449fd..4f936e5 100644
--- a/stats/forms.py
+++ b/stats/forms.py
@@ -3,8 +3,7 @@ from stats.models import CATEGORY_CHOICES, Release
 
 class ReleaseField(forms.ModelChoiceField):
     def __init__(self, *args, **kwargs):
-        super(ReleaseField, self).__init__(*args, **kwargs)
-        self.required = False
+        super(ReleaseField, self).__init__(*args, required=False, **kwargs)
         if 'label' in kwargs:
             self.is_branch = True
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]