{ "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