Package: django-extrawidgets
Ray’s Widget ExchangeRay’s Widget Exchange is a project exploring the client-side of Django
website development. The intention is to provide tools, widgets, views
and other services that aren’t appropriate for the Django core, but are
still essential for website development.Initial goals:We aim to provide a simple set of widgets that can be easily integrated into a
Django form:A calendar widgetA numerical range widgetA time widgetAn AJAX autocomplete widgetA color palettefull RGB selectionselection from subset of colorsLonger term goals:Handle compression and aggregation of CSS and JavaScript artefacts. (Note by
Reinout: probably not, as an app should do only one thing:
compression/aggregation can be done by other apps).Client-side input validation (possibly by Ajax callback?)InstallationRay’s widget exchange depends ondjango-staticfilesas that’s the best way at
the moment to handle css and javascript files.  It is also, probably, going to
end up in one form or the other in Django 1.3.django-rays’setup.pyhas an automatic dependency on django-staticfiles,
so installing django-rays automatically brings in django-staticfiles.Add bothraysandstaticfilesto your settings file’sINSTALLED_APPS.Django-staticfiles needs a bit of boilerplate. Django 1.3 ought to make this
unnecessary, btw.  Theofficial django-staticfiles documentationhas more elaborate
information and there’s also ablog postwith a more narrative explanation and example snippets.In sites where you use django-rays, you will need to add a little bit of
django-staticfiles boiler plate code to your settings file# Used for django-staticfiles
STATIC_URL = '/static_media/'
TEMPLATE_CONTEXT_PROCESSORS = (
    # Default items.
    "django.core.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    # Needs to be added for django-staticfiles to allow you to use
    # {{ STATIC_URL }}myapp/my.css in your templates.
    'staticfiles.context_processors.static_url',
    )And in your urlconf, add something like this to the end of yoururls.py:if settings.DEBUG:
    # Add this also to the projects that use this application.
    # It allows django-staticfiles to serve up the /media files
    # in DEBUG mode.
    urlpatterns += patterns('',
        (r'', include('staticfiles.urls')),
    )In production, use thebuild_staticmanagement command to prepare all
static files for apache.The css/js inclusion is happening by usingDjango’s form media handling.  So don’t forget
to add your equivalent of:{{ form.media }}somewhere in the head of your templates.DevelopmentThe source code ison bitbucket.  Thebug trackeris also there.For developers that want to use buildout, a smallbuildout.cfgthat sets
up a development and testing environment is provided.  Otherwise use your
regular virtualenv/pip setup, of course.Runpython bootstrap.pyandbin/buildoutto initialize the buildout
environment and to fetch all dependencies.  Now you can check run tests withbin/test.
You can setup a simple example project withbin/django syncdb.  Now runbin/django runserverto start the development server and point your
browser tohttp://localhost:8000/.Widget documentationAutocompleteTheAutocompleteInputwidget hooks up a regular text input widget withjquery-ui’s autocomplete.  It
currently hooks up jquery’s autocomplete with a url that provides the
necessary data (see jquery’sremote datasource demo.The url should accept atermGETparameter and return a json list of
dictionaries.  The dictionaries must have the key “value” and/or “label”.  If
one of them is missing, the other is used twice.  The label is the
user-visible string and the value is the value being put into the form data.You can pass the widget either aurl(just the url to be called) or aurlname(a name that’s looked up in the urlconf).Example usage:from django import forms
from rays.widgets import AutocompleteInput


class AnimalForm(forms.Form):
    name = forms.CharField(
        label=_('Enter animal name'),
        max_length=50,
        widget=AutocompleteInput(urlname='autocomplete-animals'))DatepickerTheDatepickerInputwidget hooks up a regular text input widget withjquery’s datepicker.Example usage:from django import forms
from rays.widgets import DatepickerInput


class DatepickerForm(forms.Form):
    start_date = forms.DateField(widget=DatepickerInput())
    end_date = forms.DateField(widget=DatepickerInput(format='%Y.%m.%d'))ContributorsThe PRIMARY AUTHORS of Ray’s Widget Exchange are:Russell Keith-Magee <russell@keith-magee.com>Gregory Müllegger <gregor@muellegger.de>Reinout van Reeshttp://reinout.vanrees.orgGlen Somerville <glen@syneus.fi>And here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS –
people who have submitted patches, reported bugs, and generally made Ray’s
Widget Exchange that much better:Changelog0.0.1 (unreleased)Added autocomplete widget.Added dateinput widget.Added jquery and jquery ui + css and i18n.Added django-staticfiles dependency as that’s the best thing nowadays for
dealing with static js/css files.