Commits

pahaz committed 5fde89a

Some fix and tests

Comments (0)

Files changed (2)

 field_type widget_type
 ----------------------
 
-Tags for get field type and field widget type.
+Tags for get field class name and field widget class name in lower case.
 
 Example::
 

widget_tweaks/tests.py

         res = render_form('{% render_field form.with_cls %}{% render_field form.with_cls class+="bar" %}{% render_field form.with_cls %}')
         self.assertEqual(res.count("class0"), 3)
         self.assertEqual(res.count("bar"), 1)
+        
+class RenderFieldTagUseTemplateVariableTest(TestCase):
+    def test_use_template_variable_in_parametrs(self):
+        res = render_form('{% render_field form.with_attrs egg+="pahaz" placeholder=form.with_attrs.label %}')
+        assertIn('egg="spam pahaz"', res)
+        assertIn('placeholder="With attrs"', res)
+        
+class RenderFieldFilter_field_type_widget_type_Test(TestCase):
+    def test_field_type_widget_type_rendering_simple(self):
+        res = render_form('<div class="{{ form.simple|field_type }} {{ form.simple|widget_type }} {{ form.simple.html_name }}">{{ form.simple }}</div>')
+        assertIn('class="charfield textinput simple"', res)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.