-
-
Save josylad/e58a7e838e700968b94732ebe5098f49 to your computer and use it in GitHub Desktop.
Datepicker template for django-crispy-forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load crispy_forms_field %} | |
<div id="div_{{ field.auto_id }}" class="control-group{% if form_show_errors and field.errors %} error{% endif %} {% if field.field.widget.attrs.class %} {{ field.field.widget.attrs.class }}{% endif %}"> | |
{% if field.label %} | |
<label for="{{ field.id_for_label }}" class="control-label {% if field.field.required %}requiredField{% endif %}"> | |
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %} | |
</label> | |
{% endif %} | |
<div class="controls"> | |
<div class="input-append"> | |
{% crispy_field field %} | |
<span class="add-on {% if active %}active{% endif %}">{{ crispy_appended_text|safe }}</span> | |
</div> | |
{% include 'bootstrap/layout/help_text_and_errors.html' %} | |
</div> | |
</div> | |
<!-- | |
To be used with bootstrap-datepicker and Django DateField. | |
http://www.eyecon.ro/bootstrap-datepicker/ | |
In your layout do: `Field('field_name', template='date.html')` | |
Make sure date.html is in your templates path. You could build a custom layout object inheriting from `Field` named `DateField` that could get parameters passed for `data-date` and `data-date-format` for example. | |
--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment