{ "info": { "author": "Steven Klass", "author_email": "sklass@pivotalenergysolutions.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development" ], "description": "******************************************\nSimple-history: History for Django Models\n******************************************\n\ndjango-simple-history is a tool to store state of DB objects on every create/update/delete. It has been tested to work in django 1.X (including 1.4 as of 08/30/2011).\n\n**Install**\n\nDownload the tar.gz, extract it and run the following inside the directory:\n\n.. code-block:: bash\n\n python setup.py install\n\n**Basic usage**\n\nUsing this package is *really* simple; you just have to ``import HistoricalRecords`` and create an instance of it on every model you want to historically track.\n\nAppend the following line you your ``MIDDLEWARE_CLASSES``\n\n\n.. code-block:: python\n\n MIDDLEWARE_CLASSES = (\n 'simple_history.middleware.CurrentUserMiddleware',\n )\n\nOn your models you need to include the following line at the top:\n\n.. code-block:: python\n\n from simple_history.models import HistoricalRecords\n\n\nThen in your model class, include the following line:\n\n.. code-block:: python\n\n history = HistoricalRecords()\n\n\nThen from either the model class or from an instance, you can access ``history.all()`` which will give you either every history item of the class, or every history item of the specific instance.\n\n**Example**\n\n.. code-block:: python\n\n class Poll(models.Model):\n question = models.CharField(max_length = 200)\n pub_date = models.DateTimeField('date published')\n\n history = HistoricalRecords()\n\n class Choice(models.Model):\n poll = models.ForeignKey(Poll)\n choice = models.CharField(max_length=200)\n votes = models.IntegerField()\n\n history = HistoricalRecords()\n\n.. code-block:: bash\n\n $ ./manage.py shell\n\n.. code-block:: python\n\n In [2]: from poll.models import Poll, Choice\n\n In [3]: Poll.objects.all()\n Out[3]: []\n\n In [4]: import datetime\n\n In [5]: p = Poll(question=\"what's up?\", pub_date=datetime.datetime.now())\n\n In [6]: p.save()\n\n In [7]: p\n Out[7]: \n\n In [9]: p.history.all()\n Out[9]: []\n\n In [10]: p.pub_date = datetime.datetime(2007,4,1,0,0)\n\n In [11]: p.save()\n\n In [13]: p.history.all()\n Out[13]: [, ]\n\n In [14]: p.choice_set.create(choice='Not Much', votes=0)\n Out[14]: \n\n In [15]: p.choice_set.create(choice='The sky', votes=0)\n Out[15]: \n\n In [16]: c = p.choice_set.create(choice='Just hacking again', votes=0)\n\n In [17]: c.poll\n Out[17]: \n\n In [19]: c.history.all()\n Out[19]: []\n\n In [20]: Choice.history\n Out[20]: \n\n In [21]: Choice.history.all()\n Out[21]: [, , ]\n\n**Copyright and license**\n\nCopyright (c) 2012-2013 Pivotal Energy Solutions. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this work except in compliance with the License.\nYou may obtain a copy of the License in the LICENSE file, or at:\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/pivotal-energy-solutions/django-simple-history/archive/simple_history-simple_history.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pivotal-energy-solutions/django-simple-history", "keywords": null, "license": "Apache License (2.0)", "maintainer": null, "maintainer_email": null, "name": "simple_history", "package_url": "https://pypi.org/project/simple_history/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/simple_history/", "project_urls": { "Download": "https://github.com/pivotal-energy-solutions/django-simple-history/archive/simple_history-simple_history.tar.gz", "Homepage": "https://github.com/pivotal-energy-solutions/django-simple-history" }, "release_url": "https://pypi.org/project/simple_history/1.3.6/", "requires_dist": null, "requires_python": null, "summary": "Simple-history: History for Django Models", "version": "1.3.6" }, "last_serial": 814554, "releases": { "1.0": [], "1.1": [ { "comment_text": "", "digests": { "md5": "b4c4bb2512904d7826a75f58cc9df651", "sha256": "97babb49e8ca0902ec1fe55a639e66b5d7e876e50aea240da2ad3e3275178dc0" }, "downloads": -1, "filename": "simple_history-1.1.tar.gz", "has_sig": false, "md5_digest": "b4c4bb2512904d7826a75f58cc9df651", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8793, "upload_time": "2013-07-12T23:03:35", "url": "https://files.pythonhosted.org/packages/85/4d/5e006ac6f5858ed39f02799f6d6b77bae0d73a6bdae771ae114cf30b2e10/simple_history-1.1.tar.gz" } ], "1.3.5": [], "1.3.6": [] }, "urls": [] }