{ "info": { "author": "dreipol", "author_email": "dev@dreipol.ch", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "# \ud83d\udd17 LinkIt\n\nLinkIt gives you a new field type `LinkField` to use on your models which allows you to effortlessly link to different models on your site. This could be a django-cms Page model,\na filer File or anything custom like a News model.\n\n\n\n## Installation \nInstall the latest version with pip and add `linkit` to your `INSTALLED_APPS` - and you're good to go.\n\n $ pip install LinkIt\n\n## Usage \nYou're now able to use the new `LinkField` on any of your models:\n\n```python\nfrom django.db.models import Model, CharField\nfrom linkit.model_fields import LinkField\n\nclass Foo(Model):\n title = CharField(max_length=255)\n link = LinkField(types=['page', 'file', 'input']) # <-- Yay!\n```\n\nIf you register this model in django admin you'll get a dropdown field where yru can choose between cms pages, filer files or just a plain input field. \nYour model is now able to link to any of these entities with one single field. \n\nIn a template you could use this link field like this:\n````html\n{{ instance.link.label }}\n````\n\n## Configuration\nThe `LinkField` takes some options which will define how the rendered widget looks and what options the content editor has:\n\n- `types: list = None` Defines which link types are allowed (see more bellow in the section \u00abTypes\u00bb) \n- `allow_target: bool = False` If set to true, the widget renders a checkbox so the editor can choose the `_target` of the link \n- `allow_label: bool = True` Renders an additonal input field so a custom label can be set\n- `allow_no_follow: bool = False` If set to true, the widget renders a checkbox so the editor can choose the `rel=\"nofollow\"` for the link \n\n## Types\nOut of the Box LinkIt ships with three types: input, file, page. The `LinkType` base class makes it easy to implement your own link type, whatever\nit may be. If you want to link to another existing model in your app, e.g. News, all you need to do is register a new link type.\n\n1. Create a file `link_types.py` in any of your apps:\n\n```python\nfrom linkit.types.model import ModelLinkType\n\n\nclass NewsLinkType(ModelLinkType):\n identifier = 'news'\n type_label = 'News'\n model = News\n\n```\n\n2. Register the new type, preferably in a `AppConfig` `ready` method:\n\n````python\nfrom django.apps import AppConfig\nfrom django.utils.translation import ugettext_lazy as _\n\n\nclass ContentConfig(AppConfig):\n name = 'contents'\n\n def ready(self):\n from contents.link_types import NewsLinkType\n from linkit.types import type_manager as linkit_manager\n\n\n linkit_manager.register(NewsLinkType)\n````\n\n3. Profit! You can now create a field like this on any of your models: `link = LinkField(types=['news', 'page])` and link to any of your news or cms pages.\n\nCheck `linkit/types` to see how the core types are implemented.\n\n### EmailType example\nSay we have a totally different new type we want to implement and can't just extend from the `ModelLinkType`. See the example bellow\nof a link type used to link to e-mail addresses with a optional subject field.\n\n````python\nclass EmailTypeForm(TypeForm):\n address = EmailField(label='E-Mail', required=True)\n subject = CharField(label='Subject', required=False, max_length=20)\n\n\nclass EmailType(LinkType):\n identifier = 'email'\n type_label = 'E-Mail'\n form_class = EmailTypeForm\n\n def real_value(self):\n return self.link.data('value')\n\n @property\n def href(self) -> Optional[str]:\n mail = self.real_value().get('address')\n subject = self.real_value().get('subject', '')\n\n return f'mailto:{mail}?subject={subject}'\n\n @property\n def label(self) -> Optional[str]:\n return self.real_value().get('address')\n````\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dreipol/linkit", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "LinkIt", "package_url": "https://pypi.org/project/LinkIt/", "platform": "", "project_url": "https://pypi.org/project/LinkIt/", "project_urls": { "Homepage": "https://github.com/dreipol/linkit" }, "release_url": "https://pypi.org/project/LinkIt/0.1.5/", "requires_dist": null, "requires_python": ">=3.6.0", "summary": "Painless link handling - be it a custom model, file or cms page", "version": "0.1.5" }, "last_serial": 5809234, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "69f4be829f98a201d7bb7b6ad5644a07", "sha256": "2ee5a4e6d6715ab04fb5c24f46aecfdadf858b2cce3af1caf746ec0a02c18388" }, "downloads": -1, "filename": "LinkIt-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "69f4be829f98a201d7bb7b6ad5644a07", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 10973, "upload_time": "2019-05-22T10:01:21", "url": "https://files.pythonhosted.org/packages/97/e1/2290af290cfda9d85d9ac60fca4ccada4a74c2bd7a92ee5b0fe7dedef303/LinkIt-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8ff9c369d79ce91938294d7351d16d3b", "sha256": "4b1bc00414c51f5bdbdb310ed211987b74e56aa71554e3b577ec680f4b6e00ee" }, "downloads": -1, "filename": "LinkIt-0.0.1.tar.gz", "has_sig": false, "md5_digest": "8ff9c369d79ce91938294d7351d16d3b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 9170, "upload_time": "2019-05-22T10:01:23", "url": "https://files.pythonhosted.org/packages/5b/ac/5bf82ec2ff7449d51e12b054405990d46d269eb0ddf02be7d8b387b162cb/LinkIt-0.0.1.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "e1fa5dc1710a6243c8891c43ccbcf724", "sha256": "8ea978d62b60bf472f0d33f68f7a11f8a22921449d6014ac78739ec9c6d1bba3" }, "downloads": -1, "filename": "LinkIt-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e1fa5dc1710a6243c8891c43ccbcf724", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 15956, "upload_time": "2019-06-25T13:52:07", "url": "https://files.pythonhosted.org/packages/fb/a0/b13cb4b9db3ad884e72a8c10325f090a5474504de10d011e6c3a471ea49a/LinkIt-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2d82b3a73a7748ca6bba8e16c6689878", "sha256": "c182a4d7622abb12767b01f87c367c7fe60e57edaa25513fa2c292f784101ca0" }, "downloads": -1, "filename": "LinkIt-0.1.0.tar.gz", "has_sig": false, "md5_digest": "2d82b3a73a7748ca6bba8e16c6689878", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 10460, "upload_time": "2019-06-25T13:52:10", "url": "https://files.pythonhosted.org/packages/8a/36/4552ffc2ac594b6073ee01089af121c50af3740e95521ad216106da633f3/LinkIt-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "d107737b1b3a165dc3b944c5c47341dc", "sha256": "956c6ba1c45607416bdc55b99be4ae38cb30eaad1424e401d9e17d66a3affcb4" }, "downloads": -1, "filename": "LinkIt-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d107737b1b3a165dc3b944c5c47341dc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 16736, "upload_time": "2019-07-18T12:55:54", "url": "https://files.pythonhosted.org/packages/40/7d/32ad9ff47437952068b2e544e6d9bdb29bb826001c0cc4363e770fc0da91/LinkIt-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cd82dd3777a9b242e84b81c64f75af23", "sha256": "e1f2c003d62c53ef11be753e6adceb71255a93e8f4e7411401aa7027fa8f981c" }, "downloads": -1, "filename": "LinkIt-0.1.1.tar.gz", "has_sig": false, "md5_digest": "cd82dd3777a9b242e84b81c64f75af23", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 11040, "upload_time": "2019-07-18T12:55:56", "url": "https://files.pythonhosted.org/packages/a1/ed/99e6e4f758b110169cbbfb079f2d2e1db24acf991bb8da311cb478f98d9c/LinkIt-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "aaf7ddb8898fdfbe85dbd17d58f49222", "sha256": "cf6f06cf385b0c763530223b8d09a288a87afd9cbb739b82be14c3db93296244" }, "downloads": -1, "filename": "LinkIt-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "aaf7ddb8898fdfbe85dbd17d58f49222", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 16984, "upload_time": "2019-07-19T06:38:38", "url": "https://files.pythonhosted.org/packages/53/ff/09a8298d9d35694cba508134b410d69fa3a5fa566776cda5a27f85979302/LinkIt-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0074f17f1fa8f65fd460f8e528446475", "sha256": "fd3a1eff03af429d95cbe483aef14dd40cef8bb2add4dd8d3a9c62d93791da20" }, "downloads": -1, "filename": "LinkIt-0.1.2.tar.gz", "has_sig": false, "md5_digest": "0074f17f1fa8f65fd460f8e528446475", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 11239, "upload_time": "2019-07-19T06:38:40", "url": "https://files.pythonhosted.org/packages/7e/78/2a4747a25aa22c244667401e91684cdc265d02467b914360d0a20a51f1de/LinkIt-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "b4b0475c4da9147e4cab7bf28cc6b1e5", "sha256": "773ec21956ddf8375ba82eb71c99f56fb639d7ec2eec386415978cae0e9666a1" }, "downloads": -1, "filename": "LinkIt-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b4b0475c4da9147e4cab7bf28cc6b1e5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 17182, "upload_time": "2019-07-24T11:19:12", "url": "https://files.pythonhosted.org/packages/49/e4/7e19e4eab933e4b77524af05e15c3b04627e9f8aa411cd39f270c90ffc4a/LinkIt-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7a7c5e92e04453314ae11b7c30d0b4fb", "sha256": "ea3f6ac5329f52f49a523e42c63947c4fac6ec5536b89a7a9b9546ad1a5df7e7" }, "downloads": -1, "filename": "LinkIt-0.1.3.tar.gz", "has_sig": false, "md5_digest": "7a7c5e92e04453314ae11b7c30d0b4fb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 11412, "upload_time": "2019-07-24T11:19:14", "url": "https://files.pythonhosted.org/packages/6c/3a/5ef2693607f46f977f04e21c8d46a2a08e79be0d83ccd40fd8d84c4e6222/LinkIt-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "2549ead378b56281614e337fb16c4f6f", "sha256": "270c1e30c15f995b4b838fdac2fcf7ed2c2c8415753028a9a44fb1e02337bea8" }, "downloads": -1, "filename": "LinkIt-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2549ead378b56281614e337fb16c4f6f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 15516, "upload_time": "2019-09-10T14:10:35", "url": "https://files.pythonhosted.org/packages/30/c3/15d7b67aa4f52bab8717d37545fb2ae87d01055dfffcc8220397ff7f9ec4/LinkIt-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dbaf1444aadda1ddd49f05810b6866ea", "sha256": "b6019ae16553eec0b645807424b377912b31bf33143435705df45dad2b89b8ae" }, "downloads": -1, "filename": "LinkIt-0.1.4.tar.gz", "has_sig": false, "md5_digest": "dbaf1444aadda1ddd49f05810b6866ea", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 11370, "upload_time": "2019-09-10T09:27:27", "url": "https://files.pythonhosted.org/packages/ac/44/bb5cdce5554fcfe0d41aa0e6ed8897e0de9b8fd3d14031e86081c1be89c0/LinkIt-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "42ab75d23d3218f4eff056471a605d18", "sha256": "4cebb859d5ae8a8e10957e9519b092f70dca7571fa33930e009607f33201a390" }, "downloads": -1, "filename": "LinkIt-0.1.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "42ab75d23d3218f4eff056471a605d18", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 15514, "upload_time": "2019-09-10T14:13:48", "url": "https://files.pythonhosted.org/packages/c2/26/666b4c86186ed0e4d7e37dd4247cd6e8ffef269e9d449b001936f62bcda5/LinkIt-0.1.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ef6fa596491ff4740a8d43ae77316e67", "sha256": "a67b292745990092ea727882cf4a1f31d04fa9847e1db61278342615008cc9ea" }, "downloads": -1, "filename": "LinkIt-0.1.5.tar.gz", "has_sig": false, "md5_digest": "ef6fa596491ff4740a8d43ae77316e67", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 11373, "upload_time": "2019-09-10T14:13:50", "url": "https://files.pythonhosted.org/packages/4a/61/1f279303be66804931a440efeb3fb69dfa59946646bc306494018efddc30/LinkIt-0.1.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "42ab75d23d3218f4eff056471a605d18", "sha256": "4cebb859d5ae8a8e10957e9519b092f70dca7571fa33930e009607f33201a390" }, "downloads": -1, "filename": "LinkIt-0.1.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "42ab75d23d3218f4eff056471a605d18", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 15514, "upload_time": "2019-09-10T14:13:48", "url": "https://files.pythonhosted.org/packages/c2/26/666b4c86186ed0e4d7e37dd4247cd6e8ffef269e9d449b001936f62bcda5/LinkIt-0.1.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ef6fa596491ff4740a8d43ae77316e67", "sha256": "a67b292745990092ea727882cf4a1f31d04fa9847e1db61278342615008cc9ea" }, "downloads": -1, "filename": "LinkIt-0.1.5.tar.gz", "has_sig": false, "md5_digest": "ef6fa596491ff4740a8d43ae77316e67", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 11373, "upload_time": "2019-09-10T14:13:50", "url": "https://files.pythonhosted.org/packages/4a/61/1f279303be66804931a440efeb3fb69dfa59946646bc306494018efddc30/LinkIt-0.1.5.tar.gz" } ] }