{ "info": { "author": "Nathan Swain", "author_email": "nathan.swain@byu.net", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "=============\nTethys Gizmos\n=============\n\nGizmos are building blocks that can be used to create beautiful interactive controls for web apps. Using gizmos,\ndevelopers can add date-pickers, plots, and maps to their templates with minimal coding.\n\nInstallation\n------------\n\nTethys Gizmos can be installed via pip or by downloading the source. To install via pip or easy_install::\n\n pip install django-tethys_gizmos\n\nTo install via download::\n\n git clone https://github.com/CI-WATER/django-tethys_gizmos.git\n cd django-tethys_gizmos\n python setup.py install\n\nDjango Configuration\n--------------------\n\n1. Add \"tethys_gizmos\" to your INSTALLED_APPS setting like this::\n\n INSTALLED_APPS = (\n ...\n 'tethys_gizmos',\n )\n\n2. Add the context processor to settings. For example::\n\n TEMPLATE_CONTEXT_PROCESSORS = ('django.contrib.auth.context_processors.auth',\n 'django.core.context_processors.debug',\n 'django.core.context_processors.i18n',\n 'django.core.context_processors.media',\n 'django.core.context_processors.static',\n 'django.core.context_processors.tz',\n 'tethys_gizmos.context_processors.tethys_gizmos_context')\n\n3. Include the Tethys Gizmos URLconf to your project urls.py with the \"gizmos\" namespace::\n\n url(r'^gizmos/', include('tethys_gizmos.urls', namespace='gizmos'))\n\n4. Tethys Gizmos makes extensive use of Twitter Bootstrap and Jquery. These libraries must be included in all templates\nthat use gizmos. Because of the prevalent use of these two libraries, we leave it to the developer to decide how to\nprovide these dependencies. It is suggested that you include them in your \"page.html\" (see below) or some other base\ntemplate that all pages in your website use.\n\n\n5. Tethys Gizmos includes a showcase of all the available gizmos including live demos and code examples. To get this page\nworking you will need to create a template called \"page.html\" in your base \"templates\" directory that includes blocks\ncalled \"styles\", \"bodytag\", \"primary_content\", and \"scripts\". Also include the Bootstrap and Jquery dependencies. Your\n\"page.html\" should look something like this::\n\n\n \n \n
\n \n \n \n {% block styles %}\n {% endblock %}\n \n \n {% block primary_content %}\n {% endblock %}\n\n {% block scripts %}\n {% endblock %}\n \n \n\n\n.. note:: The gizmos work best if your Jquery and Bootstrap JavaScript scripts are included in the head of your document as is depicted above.\n\n\nQuick Start\n-----------\n\nWhat does \"minimal coding\" mean? Take a look at the following example. Let's say you want to include a date\npicker in your template using a gizmo. First, create a dictionary with all the configuration options\nfor the date picker (more on that later) in your view/controller for the template and add it to the context::\n\n def my_view(request):\n date_picker_options = {'display_text': 'Date',\n 'name': 'date1',\n 'autoclose': True,\n 'format': 'MM d, yyyy',\n 'start_date': '2/15/2014',\n 'start_view': 'decade',\n 'today_button': True,\n 'initial': 'February 15, 2014'}\n \n context = {'date_picker_options': date_picker_options}\n \n return render(request, 'path/to/my/template.html', context)\n\n\nNext, open the template you intend to add the gizmo to and load the **tethys_gizmos** library. Be sure to\ndo this somewhere near *the top* of your template--before any gizmo occurrences. This only needs to be\ndone once for each template that uses gizmos::\n\n {% load tethys_gizmos %}\n\n\nNow, use the **gizmo** tag to insert the date picker anywhere in your template. Pass the name of the gizmo\nand the options dictionary that you passed to the template from your view as arguments::\n\n {% gizmo date_picker date_picker_options %}\n\nFinally, *at the end* of your template--after all of the **gizmo** tags--insert the **gizmo_dependencies**\ntag. This only needs to be done once for each template that uses gizmos.\n\n::\n \n {% gizmo_dependencies %}\n\n.. note:: When using Tethys Gizmos in Tethys App development, it is not necessary to include the **gizmo_dependencies** tag in the template. The dependencies are already included in the **app_base** template.\n\nAll together your template may look something like this::\n\n {% load tethys_gizmos %}\n