{ "info": { "author": "Johnny Lee", "author_email": "jleeothon@outlook.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "==========\ntrufflehog\n==========\n\nKeep track of creation, update and hiding of models\n\n.. image:: https://travis-ci.org/jleeothon/trufflehog.svg?branch=master\n :target: https://travis-ci.org/jleeothon/trufflehog\n\n------------\nInstallation\n------------\n\nThis was developed using:\n\n- Django 1.7\n- Python 3.4\n\nI cannot guarantee it will work for anything older than that, but it probably works for later versions.\n\nInstall the latest official release using pip_::\n\n pip install django-trufflehog\n\n.. _pip: https://pypi.python.org/pypi/pip\n\nYou can install the latest development version using pip::\n\n pip install git+git://github.com/jleeothon/trufflehog/\n\n\n-----\nUsage\n-----\n\n **Warning.** Until release of version 1.0, API is bound to change.\n\n~~~~~~\nModels\n~~~~~~\n\nThere are two ``Model`` subclasses that you can mix into your models: ``DateTraceable`` and ``Hideable``. The former adds two datetime fields to the model: ``created`` and ``updated``.\n\nTo include either or both in a model, mix-in these classes like this::\n\n # models.py\n \n from django.db import models\n from django.db.models import Model\n from trufflehog, import DateTracreable, Hideable\n \n class HappyHog(DateTraceable, Hideable, Model):\n name = models.CharField(max_length=100)\n happiness = models.IntegerField()\n\nGiven there exists ``happy_hog = HappyHog(name=\"Moccus\")``, check the datetime of creation and edition with ``happy_hog.created`` and ``happy_hog.updated``.\n\nWhen checking whether or not a model is hidden, ``happy_hog.hidden`` will return the datetime of deletion and can be used as a boolean test. If a boolean variable is strictly necessary, you could use ``happy_hog.is_hidden``.\n\n~~~~~~~~\nManagers\n~~~~~~~~\n\nAdd a manager to peek into only hidden or only visible model instances::\n\n # models.py\n \n import trufflehog\n \n class HappyHog(DateTraceable, Hideable, Model):\n # some fields here\n \n hidden_objects = trufflehog.VisibilityManager(visible=False)\n visible_objects = trufflehog.VisibilityManager(visible=True)\n\nBut if you want to override the default ``objects`` manager::\n\n objects = trufflehog.VisibilityManager(visible=True)\n\nYou can also create your own custom managers by mixing-in ``VisibilityManagerMixin``::\n\n # mymanagers.py\n \n from django.db import models\n import trufflehog.managers\n \n class SuperHappyHogManager(trufflehog.managers.VisibilityManagerMixin, models.Manager):\n def get_queryset(self):\n \"\"\"\n Only queries on hogs whose happiness is over 9000.\n \"\"\"\n q = super(HappyHogManager, self).get_queryset()\n q = q.filter(happiness__gt=9000)\n return q\n\n------\nThanks\n------\n\nWell, thanks. At least for reading this. Also, if you file an issue or contribute to this repository, have my thanks beforehand. Any good or bad ideas or comments are appreciated.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jleeothon/trufflehog", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-trufflehog", "package_url": "https://pypi.org/project/django-trufflehog/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-trufflehog/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/jleeothon/trufflehog" }, "release_url": "https://pypi.org/project/django-trufflehog/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "Keep track of creation, update and deletion of models", "version": "0.3.0" }, "last_serial": 1480905, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "721f5706122326092a81c13b895e1d25", "sha256": "ae031f8a314ebd153a925b8fbafdfd57896e68434a352d35a512ad5a36dfe8db" }, "downloads": -1, "filename": "django-trufflehog-0.3.0.tar.gz", "has_sig": false, "md5_digest": "721f5706122326092a81c13b895e1d25", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4082, "upload_time": "2015-03-28T01:02:26", "url": "https://files.pythonhosted.org/packages/93/b0/839874dd6cdf0dc31ec5a5238e5ae86d595ac3f1e996fabb9774dbae81c6/django-trufflehog-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "721f5706122326092a81c13b895e1d25", "sha256": "ae031f8a314ebd153a925b8fbafdfd57896e68434a352d35a512ad5a36dfe8db" }, "downloads": -1, "filename": "django-trufflehog-0.3.0.tar.gz", "has_sig": false, "md5_digest": "721f5706122326092a81c13b895e1d25", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4082, "upload_time": "2015-03-28T01:02:26", "url": "https://files.pythonhosted.org/packages/93/b0/839874dd6cdf0dc31ec5a5238e5ae86d595ac3f1e996fabb9774dbae81c6/django-trufflehog-0.3.0.tar.gz" } ] }