Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #59: add_input_classes as filter #98

Open
codeout opened this issue Jun 5, 2017 · 0 comments
Open

Fix #59: add_input_classes as filter #98

codeout opened this issue Jun 5, 2017 · 0 comments

Comments

@codeout
Copy link

codeout commented Jun 5, 2017

add_input_classes should return field to use it as a filter.

--- a/bootstrapform/templatetags/bootstrap.py
+++ b/bootstrapform/templatetags/bootstrap.py
@@ -45,20 +45,21 @@ def bootstrap_horizontal(element, label_cols='col-sm-2 col-lg-2'):

     return render(element, markup_classes)

 @register.filter
 def add_input_classes(field):
     if not is_checkbox(field) and not is_multiple_checkbox(field) \
        and not is_radio(field) and not is_file(field):
         field_classes = field.field.widget.attrs.get('class', '')
         field_classes += ' form-control'
         field.field.widget.attrs['class'] = field_classes
+    return field

I would open one-line PR if you want. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant