[damned-lies] Restored first action choice as default action



commit 175e0a4c639647be1506ebcaefcac2f848cc8319
Author: Claude Paroz <claude 2xlibre net>
Date:   Fri Sep 11 22:54:31 2015 +0200

    Restored first action choice as default action

 vertimus/forms.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/vertimus/forms.py b/vertimus/forms.py
index 25b85bd..fc8a6b0 100644
--- a/vertimus/forms.py
+++ b/vertimus/forms.py
@@ -33,9 +33,11 @@ from stats.utils import po_file_stats
 class ActionWidget(forms.Select):
     """ Custom widget to disable the separator option (containing "--------") """
     def render_options(self, choices, selected_choices):
+        if selected_choices == ['']:
+            selected_choices = []
         options = super(ActionWidget, self).render_options(choices, selected_choices)
-        options = options.replace("<option value=\"None\">--------</option>",
-                                  "<option disabled='disabled'>--------</option>")
+        options = options.replace('<option value="">--------</option>',
+                                  '<option disabled="disabled">--------</option>')
         return options
 
 


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