{ "info": { "author": "Dan Fairs", "author_email": "dan@fezconsulting.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Django", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "django-dfk\n==========\n\ndjango-dfk implements deferred foreign keys for Django. Deferred foreign keys are conceptually\nsimilar to generic foreign keys, except that they are resolved to a real foreign key at runtime,\nand cause proper foreign keys to be created in the database.\n\nThis package allows you to do two things::\n\n * Declare that a model's foreign key field is 'deferrable', and should be repointed later\n * Repoint an existing model's foreign key fields, even if that model is not django-dfk aware.\n\nYou should perform the latter with caution - consider it a similar process to monkey-patching!\n\nThis package is alpha software, and is not feature-complete. See the TODO section for what's\non the list.\n\ndjango-dfk is compatible with Python 2.6, 2.7, 3.2 and 3.3.\ndjango-dfk is compatible with django versions 1.3 - 1.7\n\nInstallation\n============\n\nInstall ``django-dfk`` using your preferred Python package manager. Use of ``virtualenv`` is\nalso recommended::\n\n pip install django-dfk\n\nUsage\n=====\n\nPointing a single foreign key\n-----------------------------\n\nLet's say you want to reinvent the wheel, and develop a commenting app. Your comment model\nmight look like this, in ``mycomments.models``::\n\n from dfk import DeferredForeignKey\n\n class Comment(models.Model):\n commenter = models.ForeignKey('auth.User')\n content = DeferredForeignKey()\n body = models.TextField()\n\n\nNow, you come to integrate this application with your blog system (which, as you're keen\non wheel reinvention, you have also written yourself). Here's ``blog/models.py``::\n\n from dfk import point\n from mycomments.models import Comment\n\n class BlogPost(models.Model):\n title = models.CharField(max_length=100)\n slug = models.SlugField()\n body = models.TextField()\n\n point(Comment, 'content', BlogPost)\n\nThe call to ``point`` will replace the ``DeferredForeignKey`` on ``Comment`` with a foreign key to BlogPost.\n\nPointing many foreign keys at once\n----------------------------------\n\nWhen writing models that use deferred foreign keys, you may need to declare that a number\nshould point to the same 'kind' of object. Let's say you had wild scope creep, and your\ncommenting app needed the ability to associate images with a blog post. So you edit\nyour comment app's models.py so it looks like this::\n\n from dfk import DeferredForeignKey\n\n class Comment(models.Model):\n commenter = models.ForeignKey('auth.User')\n content = DeferredForeignKey(name='Content')\n body = models.TextField()\n\n class Image(models.Model):\n image = models.ImageField()\n content = DeferredForeignKey(name='Content')\n\nThis expresses that both comments and images need to point to the same kind of model. This is\naccomplished with the ``point_named`` function::\n\n from dfk import point_named\n point_named('blog', 'Content', BlogPost)\n\nNow, all ``DeferredForeignKey`` instances in the ``blog`` app which are called ``Content`` will\nbe replaced by real foreign keys to ``BlogPost``.\n\n\nArguments to the generated foreign keys\n---------------------------------------\n\nWhen declaring a deferred foreign key, you may specify additional keyword arguments. Aside from\n``name``, this will be passed on verbatim to the final foreign key.\n\nIt is also possible to pass arbitrary keyword arguments in calls to ``point`` or ``point_named``.\nThese will also be passed to the final foreign key. Where arguments are present in both the\nDFK definition and in the ``point``/``point_named`` call, arguments from the latter will take\nprecedence.\n\nModel inheritance\n-----------------\n\nModel inheritance should Just Work. It's possible to have ``DeferredForeignKey``\ninstances on subclasses and base classes. The only thing to be aware of is that\nrepointing a dfk on a subclass where the key is actually defined on a\nnon-abstract base class is illegal, and will raise a ``TypeError``.\n\nCleaning object caches\n----------------------\n\nPointing or repointing foreign keys requires that related object caches are\nrepopulated as relationships will have changed and things like filtering on\nrelated objects are likely to fail.\n\nBy default object caches are cleaned after each ``point`` or ``repoint``.\nFor apps with many ``DeferredForeignKey`` instances involving the same model\nit may be more efficient to clean the caches once, after all pointing and\nrepointing has finished. To enable this pass ``clean_caches=False`` to\n``point`` or ``repoint`` and then manually call ``clean_object_caches`` as\nrequired::\n\n from dfk import point\n from dfk import clean_object_caches\n from mycomments.models import Comment\n\n class BlogPost(models.Model):\n title = models.CharField(max_length=100)\n slug = models.SlugField()\n body = models.TextField()\n\n point(Comment, 'content', BlogPost, clean_caches=False)\n clean_object_caches(Comment, BlogPost)\n\n\nAcknowledgements\n================\n\nThanks to ISM Fantasy Games Ltd. for sponsoring this package.\nPackage maintained by Dan Fairs, Rob Charlwood and Ian Dash\n\n0.0.10\n=====\n- Setup Tox environments for Django 1.7\n- Added MIDDLEWARE_CLASSES definition to test settings to avoid warnings from\n Django 1.7's system check.\n- Added install_requires limits to setup.py to reflect supported versions of\n Django\n- Updated docs.\n\n0.0.9\n=====\n- Setup Tox environments for Django 1.6\n- Fixed repoint issues under Django 1.6 due to use of new ForeignObject baseclass for related objects. \n\n\n0.0.8\n=====\n- Make codebase Python 3 compatible (3.2, 3.3) (robcharlwood@gmail.com).\n- Make codebase compatible with django 1.5.4 (robcharlwood@gmail.com)\n- New Python 3 compatible codebase has been tested against django 1.5.4 (robcharlwood@gmail.com)\n- Carried out full tidy up with PEP8 compliance. (robcharlwood@gmail.com)\n- Setup and configured ``django-dfk`` for use with ``tox`` testing library (robcharlwood@gmail.com)\n- Added full documentation on running test suite (robcharlwood@gmail.com)\n\n0.0.7\n=====\n\nMake cache cleaning optional, and fix some PEP8 compliance issues. Thanks\nto Mark Hughes (mark@ismgames.com).\n\n0.0.6\n=====\n\nFix a problem where repointing a deferred foreign key defined on a non-abstract\nbase class through a subclass would result in a new field being added to the\nlocal_fields of the subclass, shadowing the one on the base class. It is now\nillegal to do this; dfks on base classes should be pointed using the base class\nitself.\n\n0.0.5\n=====\n\nFix a problem where related object caches on models' _meta Options classes\nwere not being repopulated on a repoint. This led to problems where\nfiltering on a parent model related to a child using a deferred foreign key\ncould fail if the dfk was (re)pointed after the initial phase of model loading\nhad already taken place.\n\n0.0.4\n=====\n\n- Include a MANIFEST.in to ensure docs are packaged.\n\n0.0.3\n=====\n- Fix packaging error\n\n0.0.2\n=====\n\n- Fix an issue when repointing foreign keys on model classes with custom\n fields which use the django.db.models.SubfieldBase metaclass\n- Fix an issue migrating from Django 1.2 to 1.3.\n\n0.0.1\n=====\n\n- Initial version", "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": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-dfk", "package_url": "https://pypi.org/project/django-dfk/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-dfk/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/django-dfk/0.0.10/", "requires_dist": null, "requires_python": null, "summary": "Deferred foreign keys for Django", "version": "0.0.10" }, "last_serial": 1516381, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "bebaeae856124b33db0e6fab772f54cb", "sha256": "2eaf3758b094b60bcdd4676458a59c7712de3125d1d48bf59b0110169ca830a3" }, "downloads": -1, "filename": "django-dfk-0.0.1.tar.gz", "has_sig": false, "md5_digest": "bebaeae856124b33db0e6fab772f54cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4719, "upload_time": "2010-11-23T11:30:08", "url": "https://files.pythonhosted.org/packages/70/1d/62dba507de6b21ff7b28b469e651b8c907614bb83910e81cbed845b15984/django-dfk-0.0.1.tar.gz" } ], "0.0.10": [ { "comment_text": "", "digests": { "md5": "a9404c9f230b1a91b3c1e97666553d66", "sha256": "b52a7b836e2ce69c6ebe8dc8ef77ecc58ca2895945b5c9ed609329e18918ecfa" }, "downloads": -1, "filename": "django_dfk-0.0.10-py2-none-any.whl", "has_sig": false, "md5_digest": "a9404c9f230b1a91b3c1e97666553d66", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 11477, "upload_time": "2015-04-22T13:27:39", "url": "https://files.pythonhosted.org/packages/25/dd/12f1ff51cdfb61b8f030756fae7b0f283f3a2e3a46be1be8226b5b6c46df/django_dfk-0.0.10-py2-none-any.whl" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "e7dd61587c9a9ad5616c6d81527ba842", "sha256": "aab6a9d63433081a86136621333e5094ff59090ffd1dc4b1301ccba79fc29376" }, "downloads": -1, "filename": "django-dfk-0.0.2.tar.gz", "has_sig": false, "md5_digest": "e7dd61587c9a9ad5616c6d81527ba842", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6185, "upload_time": "2010-11-23T11:33:38", "url": "https://files.pythonhosted.org/packages/10/6b/17284a8038f17679fd95c613702f2f08871af1d712d8cb79fa35d350e153/django-dfk-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "d7ebcee6c6d02eee3a4b773091022e44", "sha256": "09ae75eba6cbaf5878c11c9d03ac4e4e1e2ef26cfafaca01c435dbb1e375a5d3" }, "downloads": -1, "filename": "django-dfk-0.0.3.tar.gz", "has_sig": false, "md5_digest": "d7ebcee6c6d02eee3a4b773091022e44", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4791, "upload_time": "2011-03-30T16:21:13", "url": "https://files.pythonhosted.org/packages/54/b8/c4b4cc280822570ff01939bb109f99c30b1d34aedf95ec6a8f5b750cfcce/django-dfk-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "a6d2152f46897d400eb7bc6466bd15ea", "sha256": "957ad9f3d0a26fb32750c55b9b39e1c18d68d79ac983e2e5485ceae594fac239" }, "downloads": -1, "filename": "django-dfk-0.0.4.tar.gz", "has_sig": false, "md5_digest": "a6d2152f46897d400eb7bc6466bd15ea", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6061, "upload_time": "2011-03-30T16:27:24", "url": "https://files.pythonhosted.org/packages/e5/4b/901b1596a3bd4e13c2c120f4db7e2fe61fd63ccdcdfa48f60297d07219d5/django-dfk-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "f74694957ff91bf1aec512abf22de004", "sha256": "3e21a1a2e3493ea3751990beb1a959dcf3163405c94d93c06bef0f7b84c72d40" }, "downloads": -1, "filename": "django-dfk-0.0.5.tar.gz", "has_sig": false, "md5_digest": "f74694957ff91bf1aec512abf22de004", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6648, "upload_time": "2011-07-28T10:00:41", "url": "https://files.pythonhosted.org/packages/23/31/1bd01ce26acf0a872081b5ebd151c5c71219708f572a324f0223d499cb21/django-dfk-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "e76a1e8490535b247c3fd6a3d35c9b96", "sha256": "c9e6b5afb04e0584ba31d6b6687967b2acf460c4f4f1c48cda9b90ec305a74f7" }, "downloads": -1, "filename": "django-dfk-0.0.6.tar.gz", "has_sig": false, "md5_digest": "e76a1e8490535b247c3fd6a3d35c9b96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7243, "upload_time": "2011-08-01T15:15:55", "url": "https://files.pythonhosted.org/packages/df/0e/4ecac2c9796da6bdd66d8346c4e8480544102bac6bc98f121ddef3fa70a4/django-dfk-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "42b0310cf536728601f3c5d634bc1ea8", "sha256": "cc12da79ccdef7863d550c7e0907f5d18b40d86c725ba4eb1df52d323db02c41" }, "downloads": -1, "filename": "django-dfk-0.0.7.tar.gz", "has_sig": false, "md5_digest": "42b0310cf536728601f3c5d634bc1ea8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7856, "upload_time": "2013-03-21T18:54:22", "url": "https://files.pythonhosted.org/packages/d4/cc/bb222ae7fc0509e2279e62dbfd8bed22a25345b7958745f145e7d667b72b/django-dfk-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "f1fc40c48d9da2ecfdaed86dc519882c", "sha256": "319e1f3a96c661268b6e10aa44d14da9e4762cb14d74dea13104edb3a9ad6696" }, "downloads": -1, "filename": "django-dfk-0.0.8.tar.gz", "has_sig": false, "md5_digest": "f1fc40c48d9da2ecfdaed86dc519882c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9570, "upload_time": "2013-09-20T18:40:11", "url": "https://files.pythonhosted.org/packages/13/27/d48687d470bf3f6546f9ed41d9a2185d2e96ea2d0d3e40145d093f555f5a/django-dfk-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "08f756e5d9048727774570ea8b62b90d", "sha256": "9201df8e17c9f2d49bb4fc2c17fe8112dd53935e453dd30d773f4a9271b19495" }, "downloads": -1, "filename": "django-dfk-0.0.10.tar.gz", "has_sig": false, "md5_digest": "08f756e5d9048727774570ea8b62b90d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12625, "upload_time": "2015-04-22T10:05:30", "url": "https://files.pythonhosted.org/packages/a5/91/2980c6700eb2ae9db1aac644c39eae0fa07ba936b19270950d3d5c235dd5/django-dfk-0.0.10.tar.gz" }, { "comment_text": "", "digests": { "md5": "bdd1aa11404fbfef3e0acecd0bb8dcb7", "sha256": "90195f80116733a0a90e14139abc71f9e270fb33f23170fddbf386cd0f860d66" }, "downloads": -1, "filename": "django-dfk-0.0.9.tar.gz", "has_sig": false, "md5_digest": "bdd1aa11404fbfef3e0acecd0bb8dcb7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9763, "upload_time": "2014-04-10T15:37:10", "url": "https://files.pythonhosted.org/packages/71/fe/f60cdf3595a0bdf3d479378e531478f406dac117b9aa22c78b8d741c9e4d/django-dfk-0.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a9404c9f230b1a91b3c1e97666553d66", "sha256": "b52a7b836e2ce69c6ebe8dc8ef77ecc58ca2895945b5c9ed609329e18918ecfa" }, "downloads": -1, "filename": "django_dfk-0.0.10-py2-none-any.whl", "has_sig": false, "md5_digest": "a9404c9f230b1a91b3c1e97666553d66", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 11477, "upload_time": "2015-04-22T13:27:39", "url": "https://files.pythonhosted.org/packages/25/dd/12f1ff51cdfb61b8f030756fae7b0f283f3a2e3a46be1be8226b5b6c46df/django_dfk-0.0.10-py2-none-any.whl" } ] }