{ "info": { "author": "Gregor M\u00c3\u00bcllegger", "author_email": "gregor@muellegger.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "====================\ndjango-publicmanager\n====================\n\nThe django-publicmanager application provides a custom queryset class and\nmanagers that handle the public availability of database objects. The classes\nprovide a ``public`` method that filters by boolean ``is_public`` and date\nbased ``pub_date`` fields.\n\nInstallation\n============\n\nAll you need to install the django-publicmanager package is a simple ``sudo\neasy_install dango-publicmanager``.\n\nUsage\n=====\n\nThe package contains just two managers. The manager ``GenericPublicManager``\nworks exactly like django's default manager except that it provides a\n``public()`` method that returns only public available objects. The athor\nmanager, ``PublicOnlyManager``, returns public objects by default without\ncalling any extra method.\n\nIt should be obvious that you will at least need a model to use one or both of these\nmanagers. The managers will use one or more of the following fields to\ndetermine if an object is public or not.\n\n* ``is_public``: This must be a ``models.BooleanField`` and if it is set to\n ``True``, it will be treated as public.\n\n* ``pub_date`` must be a ``models.DateTimeField`` or ``models.DateField``. The\n date must be either in the past or equal to the current time to make the\n object public.\n\n* You can use a status field which holds information about the public\n availability of the object. To use it you must provide the ``status_attr``\n and ``status_values`` attributes to the manager. The ``status_attr``\n specifies the field name. If the field's value is found in list\n ``status_values`` the object will be public. The most common use of this\n feature is to use it with choices. See the examples below.\n\n\nAn object is only public if all of these fields, if existent in the model, are\nevaluated to be public. This means if ``is_public`` is set to ``True`` but\n``pub_date`` points to a date in the future the whole objects will be treated\nas not public.\n\nExamples\n========\n\nHere is a pretty simple example using only the ``is_public`` and ``pub_date``\nfields::\n\n from django.db import models\n from django_publicmanager.managers import GenericPublicManager, PublicOnlyManager\n\n class Example(models.Model):\n title = models.CharField(max_length=50)\n is_public = models.BooleanField(default=True)\n pub_date = models.DateTimeField()\n\n objects = GenericPublicManager()\n public = PublicOnlyManager()\n\nNow you can access the objects like this::\n\n >>> Example.objects.create(title='A', is_public=True, pub_date=datetime.now())\n >>> Example.objects.create(title='B', is_public=True, pub_date=datetime.now() + timedelta(1))\n >>> Example.objects.create(title='C', is_public=False, pub_date=datetime.now())\n >>> Example.objects.create(title='D', is_public=True, pub_date=datetime.now() - timedelta(1))\n >>> Example.objects.all()\n [, , , ]\n >>> Example.objects.public()\n [, ]\n >>> Example.public.all()\n [, ]\n >>> Example.objects.public()\n [, ]\n >>> Example.objects.filter(title='A').public()\n []\n\nYou don't have to name the fields exactly like above. But if you use athor\nnames, you have to tell the managers the new names::\n\n from django.db import models\n from django_publicmanager.managers import GenericPublicManager, PublicOnlyManager\n\n class Example(models.Model):\n title = models.CharField(max_length=50)\n online = models.BooleanField(default=True)\n available_from = models.DateTimeField()\n\n objects = GenericPublicManager(\n is_public_attr='online',\n pub_date_attr='available_from')\n public = PublicOnlyManager(\n is_public_attr='online',\n pub_date_attr='available_from')\n\nLast but not least, an example with the ``status`` field::\n\n from django.db import models\n from django_publicmanager.managers import GenericPublicManager, PublicOnlyManager\n\n class Example(models.Model):\n STATUS_CHOICES = (\n (1, 'draft'),\n (2, 'review'),\n (3, 'public'),\n (4, 'featured'),\n )\n\n title = models.CharField(max_length=50)\n status = models.PositiveIntegerField(choices=STATUS_CHOICES)\n\n objects = GenericPublicManager(\n status_attr='status',\n status_values=(3,4))\n public = PublicOnlyManager(\n status_attr='status',\n status_values=(3,4))\n\n\n=========\nChangelog\n=========\n\n0.3.0 - 2009-12-30\n==================\n\n* First release on the python package index.\n\n0.9.1 - 2010-02-04\n==================\n\n* Adding support for django current trunk which will be 1.2\n\n0.9.2 - 2010-02-04\n==================\n\n* Fixing bug with clones of ``PublicQuerySet``. It didn't filter for public\n attributes.", "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/gregor-muellegger/django-publicmanager", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-publicmanager", "package_url": "https://pypi.org/project/django-publicmanager/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-publicmanager/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/gregor-muellegger/django-publicmanager" }, "release_url": "https://pypi.org/project/django-publicmanager/0.9.2/", "requires_dist": null, "requires_python": null, "summary": "Custom managers that handle public availability of database objects.", "version": "0.9.2" }, "last_serial": 713441, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "a2dbf49608af30be331176ac5aa17d42", "sha256": "b96992dc3e62e35a1bfd6feeda2b95611d2a981e119265d4692436b92909f666" }, "downloads": -1, "filename": "django-publicmanager-0.3.0.tar.gz", "has_sig": false, "md5_digest": "a2dbf49608af30be331176ac5aa17d42", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3677, "upload_time": "2009-12-30T15:00:57", "url": "https://files.pythonhosted.org/packages/1f/b3/9266413515c0bc3477c9b3af97e8419b04b28984618d7855a7abcc6289d8/django-publicmanager-0.3.0.tar.gz" } ], "0.9.0": [ { "comment_text": "", "digests": { "md5": "0960dbc7fcffbd44d18b97169c2b0ada", "sha256": "0100bce5099ceca78adca4addd7bef363bcf94e1baadacf4220e4639a6c2bc63" }, "downloads": -1, "filename": "django-publicmanager-0.9.0.tar.gz", "has_sig": false, "md5_digest": "0960dbc7fcffbd44d18b97169c2b0ada", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4958, "upload_time": "2010-01-05T01:17:20", "url": "https://files.pythonhosted.org/packages/28/9d/ff2daa48d20293579312d9189ef694d6f9859ad98de2360583fcb7a1d2e0/django-publicmanager-0.9.0.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "e597f5ec5f54c35b4675f4426c0e9662", "sha256": "0df366a6ceba78e4c7e01711f8610a7608886acb251a23968dcd08a6b03de596" }, "downloads": -1, "filename": "django-publicmanager-0.9.1.tar.gz", "has_sig": false, "md5_digest": "e597f5ec5f54c35b4675f4426c0e9662", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5072, "upload_time": "2010-02-04T22:03:16", "url": "https://files.pythonhosted.org/packages/85/d9/90e6d80eb4b0a15884a24e41d26bddf15b27711ea407e67698a4d039d9ae/django-publicmanager-0.9.1.tar.gz" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "f69a346c1b17120342397d7da4fc64b9", "sha256": "31429e09d04c6165b674fa94825b14cd32290b89461c419a4c73bf15b7b7ce89" }, "downloads": -1, "filename": "django-publicmanager-0.9.2.tar.gz", "has_sig": false, "md5_digest": "f69a346c1b17120342397d7da4fc64b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5212, "upload_time": "2010-08-26T12:45:12", "url": "https://files.pythonhosted.org/packages/b6/68/91681043b120d5bc5e01aad5df5501ed6aac155db919630d64c84033d1ed/django-publicmanager-0.9.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f69a346c1b17120342397d7da4fc64b9", "sha256": "31429e09d04c6165b674fa94825b14cd32290b89461c419a4c73bf15b7b7ce89" }, "downloads": -1, "filename": "django-publicmanager-0.9.2.tar.gz", "has_sig": false, "md5_digest": "f69a346c1b17120342397d7da4fc64b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5212, "upload_time": "2010-08-26T12:45:12", "url": "https://files.pythonhosted.org/packages/b6/68/91681043b120d5bc5e01aad5df5501ed6aac155db919630d64c84033d1ed/django-publicmanager-0.9.2.tar.gz" } ] }