{ "info": { "author": "Tobias Lorenz", "author_email": "tobias.lorenz@bitmazk.com", "bugtrack_url": null, "classifiers": [], "description": "Django Privacy\n==============\n\nThis is a generic app for assigning privacy related settings to whole objects\nor to single fields.\n\nIf you add e.g. user profiles to your app, you might want to let the users\ndecide where and how to publish their content.\nSome might want to hide everything from public, some might want to show private\nupdates to friends or colleagues only.\n\nWe define clearance levels to allow access or not. The lowest level is the\nleast secure. E.g.:\n\n* Level 1: Everyone can see the content.\n* Level 2: Only connected users can see the content.\n* Level 3: Only the user herself can see the content.\n\nThis app provides the backend for custom functions to (not) display content.\n\nPrerequisites\n-------------\n\nYou need at least the following packages in your virtualenv:\n\n* Django >= 1.5\n* django-hvad >= 0.3\n* django-libs >= 1.27.1\n* South\n\n\nInstallation\n------------\n\nTo get the latest stable release from PyPi::\n\n $ pip install django-privacy\n\nTo get the latest commit from GitHub::\n\n $ pip install -e git://github.com/bitmazk/django-privacy.git#egg=privacy\n\nAdd the app to your ``INSTALLED_APPS``::\n\n INSTALLED_APPS = [\n ...\n 'privacy',\n ]\n\nRun the south migrations to create the app's database tables::\n\n $ ./manage.py migrate privacy\n\nSettings\n--------\n\nPRIVACY_LEVEL_ORDERING\n++++++++++++++++++++++\n\nDefault: ['clearance_level']\n\nOrdering of the privacy levels. Use ``['-clearance_level']`` to reverse the\nordering or e.g. ``['name']`` to sort by level names.\n\nPRIVACY_CLEARANCE_LEVEL_FUNCTION (mandatory)\n++++++++++++++++++++++++++++++++++++++++++++\n\nDefault: None\n\nCustom function to return a privacy level instance for the owner/requester\nrelation. E.g. ``'myproject.privacy_settings.get_clearance_level'``\n\nYou can find an example in the ``test_app`` of this repository.\n\nPRIVACY_DEFAULT_CLEARANCE_LEVEL\n+++++++++++++++++++++++++++++++\n\nDefault: 1\n\nDefault clearance level if a field has no privacy setting assigned.\n\nUsage\n-----\n\nTemplate Tags\n+++++++++++++\n\n``is_access_allowed``\n\nThis assignment tag will check the relation of an object owner to the requester\nand will return a ``True`` or ``False``. You can check the level for the whole\nobject or for a field of the object::\n\n {% load privacy_tags %}\n {% is_access_allowed object.user request.user object 'first_name' as access_allowed %}\n {% if access_allowed %}\n {{ object.first_name }}\n {% endif %}\n\n--------------------------------------------------------------------------------\n\n``render_privacy_level_field``\n\nThis inclusion tag will generate a privacy level next to your standard form\nfield::\n\n {% load privacy_tags %}\n {% render_privacy_level_field form.instance %}\n {% for field in form %}\n {{ field }} {% render_privacy_level_field form.instance field.field.name %}\n {% endfor %}\n\nFor carefree update forms use it with our ``PrivacyFormMixin`` (see below).\n\n\n--------------------------------------------------------------------------------\n\n``get_privacy_setting``\n\nThis assignment tag will return the current privacy setting::\n\n {% load privacy_tags %}\n {% get_privacy_setting form.instance 'name' as current_setting %}\n\nThe tag can be used with a field name or without to get the setting of the\nwhole object.\n\n\nForm Mixin\n++++++++++\n\n``PrivacyFormMixin``\n\nThis form mixin handles privacy related form data (in case you use our\n``render_privacy_level_field`` template tag). Just add the mixin class to your\nform and privacy settings will be saved::\n\n from django import forms\n from privacy.forms import PrivacyFormMixin\n class MyModelForm(PrivacyFormMixin, forms.ModelForm):\n class Meta:\n model = MyModel\n fields = ('field1', 'field2')\n\n\nQueryset helper\n+++++++++++++++\n\nIf you want to filter querysets outside of templates (to keep pagination alive\nor to use custom model managers), you can use the following helper:\n\n``filter_privacy_level``\n\nJust pass a ``queryset`` and a ``clearance_level``. You can also filter for\nmatching levels, just use ``exact``. An example::\n\n class MyListView(ListView):\n model = MyModel\n\n def get_queryset(self):\n qs = super(MyListView, self).get_queryset()\n clearance_level = get_clearance_level(self.owner, self.request.user)\n return filter_privacy_level(qs, clearance_level, self.request.GET.get('exact'))\n\n\nRoadmap\n-------\n\nSee the issue tracker for current and upcoming features.", "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/bitmazk/django-privacy", "keywords": "django,reusable,privacy,setting", "license": "The MIT License", "maintainer": null, "maintainer_email": null, "name": "django-privacy", "package_url": "https://pypi.org/project/django-privacy/", "platform": "OS Independent", "project_url": "https://pypi.org/project/django-privacy/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/bitmazk/django-privacy" }, "release_url": "https://pypi.org/project/django-privacy/0.2/", "requires_dist": null, "requires_python": null, "summary": "Reusable Django app to add privacy settings to fields and/or objects.", "version": "0.2" }, "last_serial": 950452, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "e1408bf39659b0370cd328b00b2784ba", "sha256": "2f872de3dabd156698bf741568a2fdb7301718c365f6bd47d474ce49f61afea5" }, "downloads": -1, "filename": "django-privacy-0.1.tar.gz", "has_sig": false, "md5_digest": "e1408bf39659b0370cd328b00b2784ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13090, "upload_time": "2013-11-26T20:36:18", "url": "https://files.pythonhosted.org/packages/df/89/64d64132717f65281281c8eae107aaa9f5346504b1e3aa199278a9ba0134/django-privacy-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "5c8e3915bbeb14a38c2842fc46d51674", "sha256": "af1f6212ed743d52017588058421d7a0b75017b9c8b3e4a46835fb63a0230389" }, "downloads": -1, "filename": "django-privacy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "5c8e3915bbeb14a38c2842fc46d51674", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13370, "upload_time": "2013-11-27T09:23:49", "url": "https://files.pythonhosted.org/packages/cf/fc/76487b72ab767d54518998f366e7da6754d34036e40d30de7e77916ba823/django-privacy-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "ee34f0756335134360039dd162a5ae0e", "sha256": "e838963c082dea758ae787204a25af2001416e92b381048663ece61f2274c774" }, "downloads": -1, "filename": "django-privacy-0.1.2.tar.gz", "has_sig": false, "md5_digest": "ee34f0756335134360039dd162a5ae0e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13449, "upload_time": "2013-11-27T10:29:32", "url": "https://files.pythonhosted.org/packages/48/a6/9cc75317a79dd1e7da85f055ce1ab6ea50662b2476705f4a2f75478c32a4/django-privacy-0.1.2.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "29bde2d60d33726fdafd1653bbb0ec73", "sha256": "302c38de3c43e2f1833dbd02f7133aa18c799d5a5e84a37807ce2e7d39b0f5e0" }, "downloads": -1, "filename": "django-privacy-0.2.tar.gz", "has_sig": false, "md5_digest": "29bde2d60d33726fdafd1653bbb0ec73", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13820, "upload_time": "2013-12-21T13:13:11", "url": "https://files.pythonhosted.org/packages/8f/63/7204cb952e807ba72060a5d318c3d736d428c3cef4f614a0baaf179194eb/django-privacy-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "29bde2d60d33726fdafd1653bbb0ec73", "sha256": "302c38de3c43e2f1833dbd02f7133aa18c799d5a5e84a37807ce2e7d39b0f5e0" }, "downloads": -1, "filename": "django-privacy-0.2.tar.gz", "has_sig": false, "md5_digest": "29bde2d60d33726fdafd1653bbb0ec73", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13820, "upload_time": "2013-12-21T13:13:11", "url": "https://files.pythonhosted.org/packages/8f/63/7204cb952e807ba72060a5d318c3d736d428c3cef4f614a0baaf179194eb/django-privacy-0.2.tar.gz" } ] }