{ "info": { "author": "The Atlantic", "author_email": "atmoprogrammers@theatlantic.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "# django-curation\n\n**django-curation** is a django module that provides a model used for curating\nother model objects and proxying their attributes.\n\n## Example\n\n```python\nfrom django.db import models\n\nfrom curation.models import CuratedItem, CuratedGroup, CuratedItemManager\nfrom curation.fields import CuratedForeignKey\n\nfrom blog.models import Post\n\nclass CuratedPostGroup(CuratedGroup):\n pass\n\nclass CuratedPost(CuratedItem):\n formfield_overrides = {\n 'custom_title': 'title',\n }\n objects = CuratedItemManager()\n\n group = models.ForeignKey(CuratedPostGroup)\n post = curation.fields.CuratedForeignKey(Post)\n custom_title = models.CharField(max_length=255, null=True, blank=True,\n db_column='title')\n```\n\n## Internals\n\n### *class* **curation.models.CuratedItem**\n\nAbstract class representing an item in a curated group.\n\nIn order for a model that extends this class to proxy successfully,\nit must define a **CuratedForeignKey** field.\n\n```python\nclass CuratedPost(CuratedItem):\n post = curation.fields.CuratedForeignKey(Post)\n```\n\n##### field_overrides = *{}*\n\nA dict that maps field names in the proxy model (the to=... model in the\n**CuratedForeignKey**) to field names in the current model which can override\nthem (provided their value is not None or an empty string).\n\nThis takes the form:\n\n```python\nfield_overrides = {\n 'title': 'custom_title',\n 'status': 'custom_status',\n}\n```\n\nWhere `custom_title` and `custom_status` are fields in the model extending\n**CuratedItem**, and `title` and `status` are fields in the proxy model.\n\n##### primary_id = *models.AutoField(primary_key=True, db_column='id')*\n\nCustom primary key to prevent conflicts with the proxy model's primary key.\n\n
\n\n### *class* curation.models.CuratedItemManager\n\nA manager that defines queryset helpers for CuratedItem.\n\n##### group(*slug*)\n\nFilter the current queryset to rows with curated groups having slug \"slug\".\n\n
\n\n### *class* **curation.base.CuratedItemModelBase**\n\nOverrides **ModelBase** to check whether a **curation.fields.CuratedForeignKey**\nis defined on the model. If not, throw a **TypeError**.\n\n
\n\n### *class* **curation.fields.CuratedForeignKey**\n\nA ForeignKey that gets a list of the `__dict__` keys and field names of the\nrelated model on load. It saves this list to the `_proxy_attrs` attribute of\nits parent model's `_meta` attribute.\n\n##### contribute_to_class(*cls, name*)\n\nA django built-in that adds attributes to the model class in which it is\ndefined.\n\nThis method sets the `_curated_proxy_field_name` on the `_meta` attribute\nof the **CuratedForeignKey**'s parent model to the field's name (e.g. \"post\"\nin the example at the very beginning of this README).\n\n##### contribute_to_related_class(*cls, related*)\n\nA django built-in that adds attributes to the class a **RelatedField**\npoints to.\n\nIn this case we're adding `_proxy_attrs` to the _meta attribute of the \n**ForeignKey**'s parent model, not the related model. The reason we're not\nusing `contribute_to_class` is that we need the related class to be\ninstantiated to obtain its field names, and the related class may not be loaded\nyet when `contribute_to_class` is called (for instance, if it is lazy loaded,\nwhen the ForeignKey field is defined using a string for the model).\n", "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/theatlantic/django-curation", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-curation", "package_url": "https://pypi.org/project/django-curation/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-curation/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/theatlantic/django-curation" }, "release_url": "https://pypi.org/project/django-curation/1.0.31/", "requires_dist": null, "requires_python": null, "summary": "A model used for curating other models and proxying their attributes", "version": "1.0.31" }, "last_serial": 1701382, "releases": { "1.0.31": [ { "comment_text": "", "digests": { "md5": "1c4e36db6c2507f636f8261803a49ac9", "sha256": "7050f42cea896e1e39403be16b17ee6c0d88289564ec2dd6647c3fed4eae2255" }, "downloads": -1, "filename": "django_curation-1.0.31-py2-none-any.whl", "has_sig": false, "md5_digest": "1c4e36db6c2507f636f8261803a49ac9", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 29007, "upload_time": "2015-08-31T11:55:00", "url": "https://files.pythonhosted.org/packages/44/a4/7fc75d1502dd0cfaa2f4ea1e6489d1a640e8242d3acf3849ed49225024cf/django_curation-1.0.31-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "33e4d57fcda3060382713cf9204ba2a3", "sha256": "0dd31abc3b44d26661f2a34e95a5c3bc1d74925b760c641fac1cf4915e157d53" }, "downloads": -1, "filename": "django-curation-1.0.31.tar.gz", "has_sig": false, "md5_digest": "33e4d57fcda3060382713cf9204ba2a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25247, "upload_time": "2015-08-31T11:54:51", "url": "https://files.pythonhosted.org/packages/d1/8f/c65bc465a8c5ff9e6afc945aee1d9e16355ebda0457b6f6db879ac0515f0/django-curation-1.0.31.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1c4e36db6c2507f636f8261803a49ac9", "sha256": "7050f42cea896e1e39403be16b17ee6c0d88289564ec2dd6647c3fed4eae2255" }, "downloads": -1, "filename": "django_curation-1.0.31-py2-none-any.whl", "has_sig": false, "md5_digest": "1c4e36db6c2507f636f8261803a49ac9", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 29007, "upload_time": "2015-08-31T11:55:00", "url": "https://files.pythonhosted.org/packages/44/a4/7fc75d1502dd0cfaa2f4ea1e6489d1a640e8242d3acf3849ed49225024cf/django_curation-1.0.31-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "33e4d57fcda3060382713cf9204ba2a3", "sha256": "0dd31abc3b44d26661f2a34e95a5c3bc1d74925b760c641fac1cf4915e157d53" }, "downloads": -1, "filename": "django-curation-1.0.31.tar.gz", "has_sig": false, "md5_digest": "33e4d57fcda3060382713cf9204ba2a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25247, "upload_time": "2015-08-31T11:54:51", "url": "https://files.pythonhosted.org/packages/d1/8f/c65bc465a8c5ff9e6afc945aee1d9e16355ebda0457b6f6db879ac0515f0/django-curation-1.0.31.tar.gz" } ] }