Package: popit-django
PopIt Django App================|Build Status|A Django app that makes it easy to locally store and use data from oneor more PopIt API instances.What is PopIt and PopIt-API?----------------------------PopIt is a project from `mySociety <http://www.mysociety.org/>`__ thataims to make it really simple to store and share data on people such aspoliticians, organisations such as parliaments and political parties,and the posts and memberships that link the people to the organisations.The PopIt-API is a self standing server that provides a HTTP REST API toread and write this data. It is a `separatecodebase <https://github.com/mysociety/popit-api>`__ to this one.This Django app lets you fetch data from several PopIt-APIs and store itlocally in your Django project so that you can use all the power of theDjango ORM to query the data. There are also management commands thatmake it easy to fetch the latest updates from the PopIt-API.It will also let you store your own data in the same models so that youcan add to the data from the PopIt-APIs. In time it should be possibleto push this local data out to a PopIt-API so that it is easy for othersto reuse.WARNING - Alpha code--------------------This is alpha code and subject to frequent and backwards incompatiblechange. Feel free to experiment but do not use in production until thismessage is removed.This code is a work in progress - it is probably not useful to you yet.Please see the ``IDEAS.md`` file for possible future additions and the`currentissues <https://github.com/mysociety/popit-django/issues?state=open>`__for more immediately planned work.Installing and configuring--------------------------Please install ``popit-django`` from PyPI. You should also add it toyour project's ``requirements.txt``... code:: bashpip install popit-django --use-mirrorsIn your ``settings.py`` add ``south`` and ``popit`` to your``INSTALLED_APPS`` (``popit`` uses South to manage database migrationsso make sure it comes first)... code:: pythonINSTALLED_APPS = [# ...'south','popit',# ....]Setup the database:.. code:: bashpython manage.py syncdbpython manage.py migrateNow create a ``popit.models.ApiInstance`` entry and fetch all thedocuments from that API instance:.. code:: bashpython manage.py popit_retrieve_allDatabase notes--------------For some of the referential integrity we use a ``UNIQUE INDEX`` toprevent duplicates on values that are ``NOT NULL``. This is known towork with Postgres and SQLite, but other databases may have issues. Seethe ``PopItURLField`` class in ``popit/fields.py`` for more details.Development-----------If you want to contribute to the development of ``popit-django`` thatwould be great, we aim to be responsive to pull requests. Theseinstructions should get you a dev environment set up.To run the tests you'll need a local PopIt-API instance that can bedeleted. This will be installed for you by the``start_local_popit_api.bash`` script, but it requires the following:-  `MongoDB <http://www.mongodb.org/>`__ for the PopIt-API instance.Shouldallow anonymous access and db creation (the default).-  `Node.js <http://nodejs.org/>`__ installed... code:: bash# get the code (you might want to clone your fork instead)git clone https://github.com/mysociety/popit-django.gitcd popit-django# Set up virtual environmentvirtualenv --no-site-packages .venv. .venv/bin/activate# Install the python dependenciespip install -r requirements.txt --use-mirrors# Install (if needed) and start the popit-api server./start_local_popit_api.bash# Run the tests./manage.py test popit.. |Build Status| image:: https://travis-ci.org/mysociety/popit-django.png?branch=master:target: https://travis-ci.org/mysociety/popit-django