{ "info": { "author": "Interaction Consortium", "author_email": "studio@interaction.net.au", "bugtrack_url": null, "classifiers": [], "description": "|Build Status| |Coverage Status| |Version|\n\nOverview\n========\n\nProvides a polymorphic parent ``User`` model and several child models.\n\nYou can enable and disable child models without affecting foreign keys\nto the the parent model, and avoid complicated schema and data\nmigrations.\n\nYou can even have multiple child models active at the same time!\n\nHow It Works\n============\n\nThe polymorphic parent model contains the bare minimum required by\nDjango for a user model. This is where your foreign keys will point to\n(via the ``AUTH_USER_MODEL`` setting), and this allows you to avoid\nschema migrations when changing child models.\n\nCheck out the\n`django-polymorphic `__\ndocs for more information on the underlying system that makes this\npossible.\n\nPlugins\n=======\n\nSeveral child models are also provided as ``usertype`` plugins for\ncommon use cases (email login, username login, etc.), along with a\nnumber of abstract models and mixin classes that you can use to create\nyour own plugins.\n\nFor example:\n\n::\n\n # myproject/usertypes/foo/models.py\n\n from django.utils.translation import ugettext_lazy as _\n from polymorphic_auth.models import AbstractUser\n\n class FooUser(AbstractUser):\n foo = models.CharField(unique=True)\n\n USERNAME_FIELD = 'foo'\n\n class Meta:\n verbose_name = _('user with foo login')\n verbose_name_plural = _('users with foo login')\n\nThen just add your plugin to the ``INSTALLED_APPS`` setting and point to\nyour model in the ``POLYMORPHIC_AUTH['DEFAULT_CHILD_MODEL']`` setting:\n\n::\n\n # myproject/settings.py\n\n AUTH_USER_MODEL = 'polymorphic_auth.User'\n INSTALLED_APPS += ('myproject.usertypes.foo', )\n POLYMORPHIC_AUTH = {'DEFAULT_CHILD_MODEL': 'foo.FooUser'}\n\nADMINS and MANAGERS Settings\n============================\n\nThe default app contains a ``post_migrate`` signal handler that will\ncreate superuser and staff accounts for each name and email in the\n``ADMINS`` and ``MANAGERS`` settings, and write the credentials to\n``sys.stdout`` (configurable).\n\nSay goodbye to ``./manage.py createsuperuser``!\n\nTo add support to your custom plugins, override the\n``AbstractUser.try_create`` classmethod and have it derive values for\nrequired fields from the ``name`` and ``email`` kwargs.\n\nFor example:\n\n::\n\n # myproject/usertypes/foo/models.py\n\n import re\n\n class FooUser(AbstractUser):\n ...\n\n @classmethod\n def try_create(self, **kwargs):\n email = kwargs.get('email', '')\n kwargs.setdefault('foo', re.sub(r'@.+', '', email))\n return super(FooUser, cls).try_create(**kwargs)\n\nAdmin\n=====\n\nIf more than one plugin is installed, you will be asked which type of\nuser you want to create when adding a new user via the admin. If there\nis only one plugin installed, it will take you directly to the change\nform for that plugin.\n\nYou can customise the admin class for your plugins:\n\n::\n\n # myproject/usertypes/foo/admin.py\n\n from myproject.usertypes.foo.forms import FooForm\n from polymorphic_auth.admin import UserChildAdmin\n\n class EmailUserAdmin(UserChildAdmin):\n\n # define custom features here\n\nTODO\n====\n\n- Registration system for plugins, instead of hard coding the provided\n ones and checking ``INSTALLED_APPS``.\n- Authentication backend that checks all registered plugins, not just\n the one assigned to ``POLYMORPHIC_AUTH['DEFAULT_CHILD_MODEL']``.\n- Make ``email`` field case insensitive.\n\n.. |Build Status| image:: https://img.shields.io/travis/ixc/django-polymorphic-auth.svg\n :target: https://travis-ci.org/ixc/django-polymorphic-auth\n.. |Coverage Status| image:: https://img.shields.io/coveralls/ixc/django-polymorphic-auth.svg\n :target: https://coveralls.io/github/ixc/django-polymorphic-auth\n.. |Version| image:: https://img.shields.io/pypi/v/django-polymorphic-auth.svg\n :target: https://pypi.python.org/pypi/django-polymorphic-auth", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ixc/django-polymorphic-auth", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-polymorphic-auth", "package_url": "https://pypi.org/project/django-polymorphic-auth/", "platform": null, "project_url": "https://pypi.org/project/django-polymorphic-auth/", "project_urls": { "Homepage": "https://github.com/ixc/django-polymorphic-auth" }, "release_url": "https://pypi.org/project/django-polymorphic-auth/0.4/", "requires_dist": null, "requires_python": null, "summary": "Polymorphic user model with plugins for common options, plus abstract and mixin classes to create your own.", "version": "0.4" }, "last_serial": 2716943, "releases": { "0.3": [ { "comment_text": "", "digests": { "md5": "c820e0400e51d27eb9d3ff253fe4539a", "sha256": "17fec1250b50207df829d88b56bd5372432d2910f93ee8992a7f44806a9fd8bb" }, "downloads": -1, "filename": "django_polymorphic_auth-0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c820e0400e51d27eb9d3ff253fe4539a", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 24894, "upload_time": "2016-08-13T01:58:01", "url": "https://files.pythonhosted.org/packages/db/16/d714eb1588184b6120845db95e51faa6bf24bc380671e8cf8c5db4dfaa7f/django_polymorphic_auth-0.3-py2.py3-none-any.whl" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "2ab164a0b7c8b85a21a18d8696b0352e", "sha256": "8b856173479d7373774c192f8d9badad8ff47a5e043317db58d659ae359df896" }, "downloads": -1, "filename": "django_polymorphic_auth-0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2ab164a0b7c8b85a21a18d8696b0352e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 24940, "upload_time": "2017-03-20T08:02:37", "url": "https://files.pythonhosted.org/packages/32/8c/7a1c0ba62072a52a7ea957eae728afc400f79cea4ef7ab363c0e1c93d94a/django_polymorphic_auth-0.4-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2ab164a0b7c8b85a21a18d8696b0352e", "sha256": "8b856173479d7373774c192f8d9badad8ff47a5e043317db58d659ae359df896" }, "downloads": -1, "filename": "django_polymorphic_auth-0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2ab164a0b7c8b85a21a18d8696b0352e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 24940, "upload_time": "2017-03-20T08:02:37", "url": "https://files.pythonhosted.org/packages/32/8c/7a1c0ba62072a52a7ea957eae728afc400f79cea4ef7ab363c0e1c93d94a/django_polymorphic_auth-0.4-py2.py3-none-any.whl" } ] }