Commits

msaelices committed 92b49ed Draft Merge

Comments (0)

Files changed (4)

+0.2.1
+-----
+
+* Fix a error, when a param of the dict was None
+
 0.2.0
 -----
 

configfield/fields.py

         self.widget = ConfigWidget(show_debug)
         self.config = {}
 
-    def set_config_dict(self, config_dict):
+    def set_config_dict(self, config_dict, len_to_text=250):
         config = {}
         for key, val in config_dict.items():
             if isinstance(val, bool):
                 config[key] = List(name=key, label=key, default=val)
             elif isinstance(val, int):
                 config[key] = Integer(name=key, label=key, default=val)
-            elif len(val) > 250:
+            elif isinstance(val, basestring) and len(val) > len_to_text:
                 config[key] = Text(name=key, label=key, default=val)
             else:
                 config[key] = Single(name=key, label=key, default=val)

configfield/templates/configfield/text_widget.html

 {% load i18n %}
 
 {% block param_container %}
-  <textarea {{ widget_attrs }} >
-    {{ param.get_value_display|default_if_none:"" }}
-  </textarea>
+<textarea {{ widget_attrs }} >{{ param.get_value_display|default_if_none:"" }}</textarea>
 {% endblock %}
 
 setup(
     name="django-configfield",
-    version="0.2.0",
+    version="0.2.1",
     install_requires=parse_requirements('requirements.txt'),
     dependency_links=parse_dependency_links('requirements.txt'),
     author="Manuel Saelices",