diff --git a/core/templatetags/bootstrap_field.py b/core/templatetags/bootstrap_field.py index 84d8f00..7216aff 100644 --- a/core/templatetags/bootstrap_field.py +++ b/core/templatetags/bootstrap_field.py @@ -1,10 +1,10 @@ -from django.template import loader, Context, Library - - +from django.template import Library + register = Library() - - -@register.simple_tag -def bootstrap_field(field): - template = loader.get_template('core/templatetags/bootstrap_field.html') - return template.render(Context({'field': field})) + +@register.filter(name='bootstrap_field') +def bootstrap_field(field, class_attr): + return field.as_widget(attrs={ + 'placeholder': field.label, + 'class': class_attr + }) diff --git a/pinry/templates/includes/field.html b/pinry/templates/includes/field.html index 50b1d9b..9d39b41 100644 --- a/pinry/templates/includes/field.html +++ b/pinry/templates/includes/field.html @@ -1,5 +1,7 @@ +{% load bootstrap_field %} +
- + {{ field|bootstrap_field:"form-control input-lg" }} {% if field.errors %} {% if field.errors %}