Socket
Socket
Sign inDemoInstall

django_bootstrap3_daterangepicker

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    django_bootstrap3_daterangepicker

Django date range form field


Maintainers
1

Readme

django-bootstrap3-daterangepicker

This is django field wrapper for http://www.daterangepicker.com/ . Useful for reporting services.

Field data format is tuple (start_date, end_date).

Installation:

  1. pip install django_bootstrap3_daterangepicker
  2. add 'django_bootstrap3_daterangepicker' to INSTALLED_APPS

Usage:

  • jQuery, Bootstrap are required on target page
class PeriodFilter(forms.Form):
    range = DateRangeField(widget=DateRangeWidget(picker_options={
        'ranges': common_dates()
    }))

# ...    
form = PeriodFilter(initial={'range': (date.today(), date.today())})
# ...
(from_date, to_date) = form.cleaned_data['range']

Template - don't forget media:

{% block extracss %}
    {{ filter.media['css'] }}
{% endblock %}
{% block endscripts %}
    {{ super() }}
    {{ filter.media['js'] }}
{% endblock %}

{% block content %}
{{ filter.range }}
{% endblock %}

Special thanks to https://github.com/nkunihiko/django-bootstrap3-datetimepicker/ for guidance in creating custom fields.

Keywords

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc