{ "info": { "author": "arteria GmbH", "author_email": "admin@arteria.ch", "bugtrack_url": null, "classifiers": [], "description": "# Django Userproperty\n\n[![Build Status](https://travis-ci.org/arteria/django-userproperty.svg?branch=master)](https://travis-ci.org/arteria/django-userproperty)\n[![Coverage Status](https://coveralls.io/repos/arteria/django-userproperty/badge.svg?branch=master&service=github)](https://coveralls.io/github/arteria/django-userproperty?branch=master)\n[![PyPI](https://img.shields.io/pypi/v/django-userproperty.svg)](https://pypi.python.org/pypi/django-userproperty)\n\n\ndjango-userproperty is a reusable Django app that manages per user and global properties. In addition, django-userproperty provides helper functions to set, get, incerement and decrement these properties.\n\n\n## Installation\n\nInstall the package:\n\n pip install django-userproperty\n\nAdd the app in you settings.py:\n\n INSTALLED_APPS = (\n 'userproperty',\n )\n\nUpdate your root urls.py file:\n\n ...\n url(r'^properties/', include('userproperty.urls')),\n ...\n\n\nAnd finally sync your db\n\n python manage.py syncdb\n\n\n## Usage\n\n### API for asynchronous Usage\n\nThis app is designed to be used with JavaScript/jQuery and asynchronous requests. It provides so besic API interfaces to get and set Properties\n\n#### `get-uproperty`\n\n> logged-in user is required\n\n**name**: name of the user-property\ndefault: default value, will be retuned if user-property not found\n\n $.get(\"/get-uproperty/?name=&default=\", function(data) {\n alert(data);\n });\n\nresponse:\n\n {\"status\": \"success\", \"number-of-items\": \"50\"} // or 100 if the property number-of-items was not found\n\n#### `set-uproperty`\n\n> logged-in user is required\n\n**name**: name of the user-property\n**value**: value of the user-property to set\n\n $.get(\"/set-uproperty/?name=&value=\", function(data) {\n alert(data);\n });\n\nresponse:\n\n {\"status\": \"success\", \"number-of-items\": \"100\"}\n\n#### `get-gproperty`\n\n> staff member is required\n\n**name**: name of the global-property\ndefault: default value, will be retuned if global-property not found\n\n $.get(\"/get-gproperty/?name=&default=\", function(data) {\n alert(data);\n });\n\nresponse:\n\n {\"status\": \"success\", \"number-of-items\": \"50\"}\n\n#### `set-gproperty` - staff member is required\n\n> staff member is required\n\n**name**: name of the global-property\n**value**: value of the global-property to set\n\n $.get(\"/set-gproperty/?name=&value=\", function(data) {\n alert(data);\n });\n\nreturns\n\n {\"status\": \"success\", \"number-of-items\": \"100\"}\n\n\n### More examples:\n\nAfter creating an account on your website, the user needs to do some tasks before he can enter his profile. In this example adding more information and agreeing to the terms and conditions.\n\nWhen creating the new user you create a new property:\n\n from userproperty.utils import addProperty\n\n addProperty(request, tag='setup')\n # if the user is not saved in the request add: anUser=yourNewUser\n\nIn your login view you can now have different outcomes based on the UserProperty\n\n from userproperty.utils import getIntegerProperty, setIntegerProperty, removeProperty\n\n #in your login view\n\n setupProperty = getIntegerProperty(request,'setup')\n\n if setupProperty == 1:\n #redirect, a form for adding phone number etc\n elif setupProperty == 2:\n #redirect, accepting the terms and conditions\n elif setupProperty:\n removeProperty(request, tag='setup')\n\n # stuff when no property was set\n\nThe only thing left to do is setting the property to a new value when the respective actions(forms in this case) are done:\n\n from userproperty.utils import setIntegerProperty, removeProperty\n\n #in the view with the form for the phonenumer etc.\n form.is_valid():\n #do stuff\n\n setIntegerProperty(request, tag='setup', value=2)\n\n #redirect login\n\n\n #in the view for terms and conditions\n form.is_valid():\n #do stuff\n\n removeProperty(request, tag='setup')\n\n #redirect login\n\nOther examples: setup tour, saving user specific properties(number of data entries displayed in js datatables), etc.\n\n## PEP8\n\nThe functions are available in pep8 (lowercase with _ as separator between words)\n\nsetIntegerProperty() ==> set_integer_property()\n\n## Change Log\n\n### 06/Aug/2015\n\n* Propper anonymous users handling.\n* ``decUserProperty`` and ``incUserProperty`` returns ``False`` instead of ``True`` for anonymous users or in case of errors.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "django-userproperty", "package_url": "https://pypi.org/project/django-userproperty/", "platform": "", "project_url": "https://pypi.org/project/django-userproperty/", "project_urls": null, "release_url": "https://pypi.org/project/django-userproperty/1.0.8/", "requires_dist": null, "requires_python": "", "summary": "django userproperty", "version": "1.0.8" }, "last_serial": 3086606, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "1c8a022946eb1fc60c6946876cfd42e3", "sha256": "fa4023639f29bdf05a11482dbf82833a63452ccb427cf2da2c8a7086a5c5a87f" }, "downloads": -1, "filename": "django-userproperty-1.0.0.tar.gz", "has_sig": false, "md5_digest": "1c8a022946eb1fc60c6946876cfd42e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4535, "upload_time": "2015-01-23T08:53:19", "url": "https://files.pythonhosted.org/packages/d1/ab/3540e5b71238893a9ba5937b65d395bb1efd045a9888a9ba3c18fc261a0d/django-userproperty-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "a31b8bad203e3eb61b48e14b12b96f58", "sha256": "0e41f714eea5ea9b7cd6f03cdf96d4ec9eb169988ce24239b47f8aa0533b2b58" }, "downloads": -1, "filename": "django-userproperty-1.0.1.tar.gz", "has_sig": false, "md5_digest": "a31b8bad203e3eb61b48e14b12b96f58", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5767, "upload_time": "2015-01-27T13:58:26", "url": "https://files.pythonhosted.org/packages/ee/f1/5dd74253e8e87ad1d3607bfa3216e8bea29ef72d2bb2d9d37151ba5844d9/django-userproperty-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "76182e5ce91118c919f27b170914aab1", "sha256": "12c828803926be6d3c80523a4919e211c1029cf5116d87429e058176c8228466" }, "downloads": -1, "filename": "django-userproperty-1.0.2.tar.gz", "has_sig": false, "md5_digest": "76182e5ce91118c919f27b170914aab1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5752, "upload_time": "2015-01-27T15:45:05", "url": "https://files.pythonhosted.org/packages/11/e2/2be8830fb4e2b7492720ad6bc213e69c55ec0ca79db21677de205b747451/django-userproperty-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "5e9b3efa41a71a5a2144374151eaa994", "sha256": "caa67728c33f8cd51ebed72d76061e40ac2d4dfd427394c614bd99e6bcff3253" }, "downloads": -1, "filename": "django-userproperty-1.0.3.tar.gz", "has_sig": false, "md5_digest": "5e9b3efa41a71a5a2144374151eaa994", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5753, "upload_time": "2015-02-12T21:29:54", "url": "https://files.pythonhosted.org/packages/30/79/ce047ee65d94401f8847df50b6990c5520058cc868db15e0b5082380da1c/django-userproperty-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "e067fa24253ae6e1490f52618c6faa97", "sha256": "5f73aa915d74861b577d88a3ebd7adbc4ca7677f4444f623c34f54b4a6b238ef" }, "downloads": -1, "filename": "django-userproperty-1.0.4.tar.gz", "has_sig": false, "md5_digest": "e067fa24253ae6e1490f52618c6faa97", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5822, "upload_time": "2015-06-18T10:13:02", "url": "https://files.pythonhosted.org/packages/a2/e0/fdf8813898aa7465137036bb1ab1d983e631738d002548af6f2f271b26c9/django-userproperty-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "f367034f19a1891e2beb10276d028ef8", "sha256": "e17dccec0e5df42cbd3469f084dac56199744df837d7f537fce80c4e297ccf93" }, "downloads": -1, "filename": "django-userproperty-1.0.5.tar.gz", "has_sig": false, "md5_digest": "f367034f19a1891e2beb10276d028ef8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6036, "upload_time": "2015-08-06T04:08:51", "url": "https://files.pythonhosted.org/packages/7a/de/9bdf5923a8a7f4f5d29569f9bf370ac7ecb95eb6bf0b5bc992754f8d3f48/django-userproperty-1.0.5.tar.gz" } ], "1.0.8": [ { "comment_text": "", "digests": { "md5": "ec3618381324d06deb00348b98ef06c5", "sha256": "e45dcd2ab77e418d5489a2ea8d1e3febbe8d1cf28b5097c1d50510cf154125f6" }, "downloads": -1, "filename": "django-userproperty-1.0.8.tar.gz", "has_sig": false, "md5_digest": "ec3618381324d06deb00348b98ef06c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8201, "upload_time": "2017-08-10T11:54:48", "url": "https://files.pythonhosted.org/packages/f4/1a/10c70f5c4a1863658f2cbbf43b94385f0c892f53088d9260962754f9273f/django-userproperty-1.0.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ec3618381324d06deb00348b98ef06c5", "sha256": "e45dcd2ab77e418d5489a2ea8d1e3febbe8d1cf28b5097c1d50510cf154125f6" }, "downloads": -1, "filename": "django-userproperty-1.0.8.tar.gz", "has_sig": false, "md5_digest": "ec3618381324d06deb00348b98ef06c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8201, "upload_time": "2017-08-10T11:54:48", "url": "https://files.pythonhosted.org/packages/f4/1a/10c70f5c4a1863658f2cbbf43b94385f0c892f53088d9260962754f9273f/django-userproperty-1.0.8.tar.gz" } ] }