{ "info": { "author": "Yigit Ozen", "author_email": "UNKNOWN", "bugtrack_url": null, "classifiers": [], "description": "=============\r\ndjango-kvtags\r\n=============\r\n\r\nExtensible tags in Django.\r\n\r\nTags can be associated with any django model. You can add as many key-value pairs to the tags as you wish.\r\n\r\n\r\nTagManager\r\n==========\r\n\r\nThe best way to use django-kvtags is through TagManager.\r\nFirst, add TagManager to your model to which you will add tags:\r\n\r\n::\r\n\r\n class YourModel(models.Model):\r\n # your stuff\r\n objects = models.Manager()\r\n tags = TagManager()\r\n\r\nIf you want django-kvtags to use cache when it's possible, pass the cache name with cache parameter to TagManager:\r\n\r\n::\r\n\r\n class YourModel(models.Model):\r\n # your stuff\r\n objects = models.Manager()\r\n tags = TagManager(cache='default')\r\n\r\n\r\n\r\nadd (obj, \\**kwargs)\r\n--------------------\r\nAdds tags matched by kwargs to obj.\r\n\r\nadd_by_kv (obj, \\**kwargs)\r\n--------------------------\r\nAdds tags whose key-values are matched by kwargs to obj.\r\n\r\nremove (obj, \\**kwargs)\r\n-----------------------\r\nRemoves tags matched by kwargs from obj.\r\n\r\nremove_by_kv (obj, \\**kwargs)\r\n-----------------------------\r\nRemoves tags whose key-values are matched by kwargs from obj.\r\n\r\nfilter (obj, \\**kwargs)\r\n-----------------------\r\nReturns QuerySet of Tags bound to obj and matched by kwargs.\r\n\r\nget_list (obj)\r\n--------------\r\nReturns a list of Tag model instances bound to obj\r\n\r\nget_id_list (obj)\r\n-----------------\r\nReturns a list of IDs of Tags bound to obj\r\n\r\nget_digest_list (self, obj)\r\n---------------------------\r\nReturns a list of objects which contains digested data of Tags bound to obj.\r\nIf cache is available and set, this method stores tag and item-tag dictionaries in the cache in order to make a lot less SQL queries. \r\n\r\n\r\nUsing API\r\n=========\r\n\r\ndjango-kvtags supports `tastypie`_.\r\n\r\nTagResource\r\n-----------\r\n\r\n::\r\n\r\n # urls.py\r\n from kvtags.api import TagResource\r\n\r\n tag_resource = TagResource()\r\n\r\n urlpatterns = patterns('',\r\n # The normal jazz here...\r\n (r'^api/', include(tag_resource.urls)),\r\n )\r\n\r\nor\r\n\r\n::\r\n\r\n # urls.py\r\n from tastypie.api import Api\r\n from kvtags.api import TagResource\r\n\r\n your_api = Api(api_name='v1')\r\n # Your other resources\r\n your_api.register(TagResource())\r\n\r\n\r\n urlpatterns = patterns('',\r\n # The normal jazz here...\r\n (r'^api/', include(your_api.urls)),\r\n )\r\n\r\n\r\nTaggedItemResource\r\n------------------\r\n\r\nTaggedItem has generic relation to your models. If you don't need to resolve the relations,\r\nyou can include TaggedItemResource to your API just as you include TagResource.\r\n\r\nHowever, if you want to resolve generic relations, you should create a new class based on\r\nTaggedItemResource by yourself. Then, add the new class to the API as usual.\r\n\r\nExample:\r\n\r\n::\r\n\r\n # urls.py\r\n from kvtags.api import TaggedItemResource\r\n from tastypie.contrib.contenttypes.fields import GenericForeignKeyField\r\n from yourapp.models import Spam, Egg\r\n from yourapp.api import SpamResource, EggResource\r\n\r\n class MyTaggedItemResource(TaggedItemResource):\r\n content_object = GenericForeignKeyField({\r\n Spam: SpamResource,\r\n Egg: EggResource\r\n }, 'content_object')\r\n\r\n\r\nAdding Tags Field to a Resource\r\n===============================\r\nIf you want to add the tags associated with a model to the model's resource, you can do that by using get_list or get_digest_list methods as follow:\r\n\r\n::\r\n\r\n class YourModelResource(ModelResource):\r\n # your stuff\r\n tags = fields.ListField()\r\n \r\n def dehydrate_tags(self, bundle):\r\n return YourModel.tags.get_digest_list(bundle.obj)\r\n\r\n\r\n.. _tastypie: https://django-tastypie.readthedocs.org/en/latest/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-kvtags", "package_url": "https://pypi.org/project/django-kvtags/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-kvtags/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/django-kvtags/1.5.1/", "requires_dist": null, "requires_python": null, "summary": "Extensible key-value tagging for Django", "version": "1.5.1" }, "last_serial": 2389309, "releases": { "1.4.0": [], "1.4.1": [ { "comment_text": "", "digests": { "md5": "39693c9366ae03eaed472ca53671f818", "sha256": "fcfcb1279cf27b1bb87e45498ba0a51668b81c78945a9b6b8771372e95f41bf9" }, "downloads": -1, "filename": "django_kvtags-1.4.1-py2.7.egg", "has_sig": false, "md5_digest": "39693c9366ae03eaed472ca53671f818", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 21244, "upload_time": "2014-10-12T18:41:45", "url": "https://files.pythonhosted.org/packages/bf/b4/65b0f9c49a4bbb44904be92124ef9d5cb56b5d617b1113f63f19c8491d47/django_kvtags-1.4.1-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "d6b5d00dd896f8b7cec1f0003126ba67", "sha256": "5a278397a6515216c541ea7378ba5d68563864a610616659afadaf2384169626" }, "downloads": -1, "filename": "django-kvtags-1.4.1.tar.gz", "has_sig": false, "md5_digest": "d6b5d00dd896f8b7cec1f0003126ba67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7173, "upload_time": "2014-10-12T18:41:42", "url": "https://files.pythonhosted.org/packages/b5/c0/0de4651506dc365f32b600d4466613155fd9d52eefbefe2f172cef8a1807/django-kvtags-1.4.1.tar.gz" } ], "1.5.1": [ { "comment_text": "", "digests": { "md5": "53276fab37274434a717d582ce58443f", "sha256": "a941a4d9bcf4fa81196eeeac30cce13f33c48ca9208409ac050441bc127b94f8" }, "downloads": -1, "filename": "django-kvtags-1.5.1.tar.gz", "has_sig": false, "md5_digest": "53276fab37274434a717d582ce58443f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7014, "upload_time": "2016-10-09T11:55:14", "url": "https://files.pythonhosted.org/packages/80/13/7f8d2200686f9ee82323d1838f128a0932c7ffa03dc7a8ff5760c2e3cf19/django-kvtags-1.5.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "53276fab37274434a717d582ce58443f", "sha256": "a941a4d9bcf4fa81196eeeac30cce13f33c48ca9208409ac050441bc127b94f8" }, "downloads": -1, "filename": "django-kvtags-1.5.1.tar.gz", "has_sig": false, "md5_digest": "53276fab37274434a717d582ce58443f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7014, "upload_time": "2016-10-09T11:55:14", "url": "https://files.pythonhosted.org/packages/80/13/7f8d2200686f9ee82323d1838f128a0932c7ffa03dc7a8ff5760c2e3cf19/django-kvtags-1.5.1.tar.gz" } ] }