{"id":13774588,"url":"https://github.com/django-cms/djangocms-link","last_synced_at":"2025-12-17T04:49:38.288Z","repository":{"id":5195877,"uuid":"6370981","full_name":"django-cms/djangocms-link","owner":"django-cms","description":"django CMS Link is a plugin for django CMS that allows you to add links on your site.","archived":false,"fork":false,"pushed_at":"2025-12-01T18:34:47.000Z","size":2159,"stargazers_count":40,"open_issues_count":7,"forks_count":67,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-12-04T08:38:57.500Z","etag":null,"topics":["addon","cms","django","django-cms","python"],"latest_commit_sha":null,"homepage":"https://django-cms.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"rabbitmq/rabbitmq-ha","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/django-cms.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2012-10-24T14:13:21.000Z","updated_at":"2025-11-14T18:05:27.000Z","dependencies_parsed_at":"2023-01-13T13:23:09.662Z","dependency_job_id":"3e6ec398-d016-4d7e-b2ed-a81c3d8a9b40","html_url":"https://github.com/django-cms/djangocms-link","commit_stats":{"total_commits":271,"total_committers":43,"mean_commits":"6.3023255813953485","dds":0.7564575645756457,"last_synced_commit":"3d056b19807dfc7c65ed779eede71277dd7e3146"},"previous_names":["divio/djangocms-link"],"tags_count":47,"template":false,"template_full_name":null,"purl":"pkg:github/django-cms/djangocms-link","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/django-cms%2Fdjangocms-link","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/django-cms%2Fdjangocms-link/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/django-cms%2Fdjangocms-link/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/django-cms%2Fdjangocms-link/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/django-cms","download_url":"https://codeload.github.com/django-cms/djangocms-link/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/django-cms%2Fdjangocms-link/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27777275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-17T02:00:08.291Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["addon","cms","django","django-cms","python"],"created_at":"2024-08-03T17:01:28.336Z","updated_at":"2025-12-17T04:49:38.275Z","avatar_url":"https://github.com/django-cms.png","language":"Python","funding_links":[],"categories":["Add-ons"],"sub_categories":[],"readme":"===============\ndjango CMS Link\n===============\n\n|pypi| |coverage| |python| |django| |djangocms|\n\n**django CMS Link** is a plugin for `django CMS \u003chttps://django-cms.org\u003e`_ that\nallows you to add links on your site.\n\nThis plugin supports child plugins. If you add an other plugin as a\nchild it will take this content instead of the link name as the content of the link.\n\nThis addon is compatible with `Divio Cloud \u003chttp://divio.com\u003e`_.\n\n.. image:: preview.gif\n\n\nContributing\n============\n\nThis is a an open-source project. We'll be delighted to receive your\nfeedback in the form of issues and pull requests. Before submitting your\npull request, please review our `contribution guidelines\n\u003chttp://docs.django-cms.org/en/latest/contributing/index.html\u003e`_.\n\nWe're grateful to all contributors who have helped create and maintain this package.\nContributors are listed at the `contributors \u003chttps://github.com/divio/djangocms-link/graphs/contributors\u003e`_\nsection.\n\nOne of the easiest contributions you can make is helping to translate this addon on\n`Transifex \u003chttps://www.transifex.com/projects/p/djangocms-link/\u003e`_.\n\n\nDocumentation\n=============\n\nSee ``REQUIREMENTS`` in the `setup.py \u003chttps://github.com/divio/djangocms-link/blob/master/setup.py\u003e`_\nfile for additional dependencies:\n\ndjango CMS Link has a weak dependency on django Filer. If\n`django Filer \u003chttp://django-filer.readthedocs.io/en/latest/installation.html\u003e`_\nis installed and configured appropriately, django CMS Link will allow linking\nfiles.\n\n* Django Filer 1.7 or higher\n* djangocms-atrributes-field 1.0 or higher\n\n\nInstallation\n------------\n\nFor a manual install:\n\n* run ``pip install djangocms-link``\n* add ``djangocms_link`` to your ``INSTALLED_APPS``\n* run ``python manage.py migrate djangocms_link``\n\n\nConfiguration\n-------------\n\nLink templates\n..............\n\nNote that the provided templates are very minimal by design. You are encouraged\nto adapt and override them to your project's requirements.\n\nThis addon provides a ``default`` template for all instances. You can provide\nadditional template choices by adding a ``DJANGOCMS_LINK_TEMPLATES``\nsetting:\n\n.. code-block:: python\n\n    DJANGOCMS_LINK_TEMPLATES = [\n        ('feature', _('Featured Version')),\n    ]\n\nYou'll need to create the ``feature`` folder inside ``templates/djangocms_link/``\notherwise you will get a *template does not exist* error. You can do this by\ncopying the ``default`` folder inside that directory and renaming it to\n``feature``.\n\nLink types\n...........\n\nBy default, django CMS Link provides three major link types: internal, external,\nand file link (if django-filer is installed).\n\nPhone links or email links can be entered by using the ``tel:`` or ``mailto:``\nscheme, respectively, in the external link field.\n\nBy changing the ``DJANGOCMS_LINK_ALLOWED_LINK_TYPES`` setting you can limit\nthe type of links accepted. The default is::\n\n    DJANGOCMS_LINK_ALLOWED_LINK_TYPES = [\n        'internal_link',  # Pages and other models\n        'external_link',  # Hand-typed URLs\n        'file_link',      # Files from django-filer\n        'tel',            # Phone numbers as external links using the tel: scheme\n        'mailto',         # Email addresses as external links using the mailto: scheme\n        'anchor',         # Anchors in the current page as external links using #\n    ]\n\nLinkable models\n...............\n\n*Added in version 5:*\n\nBy default, django CMS Link will autodetect which Django or Django CMS models it\ncan create internal links to. To make a model appear in the list of internal\nlinks, you need to\n\n* register a model admin for the model and provide a ``search_fields``\n  attribute. django CMS Link uses the same search logic as the Django admin.\n* provide a ``get_absolute_url()`` method on the model. This method should\n  return the URL of the model instance.\n\nIf you do not want to use auto detection, you can provide a list of models\nin the ``DJANGOCMS_LINKABLE_MODELS`` setting using dotted strings::\n\n    DJANGOCMS_LINKABLE_MODELS = [\n        'myapp.mymodel',\n    ]\n\nAttention: ``Page`` objects are always linkable.\n\ndjango CMS Link will use the model admin's ``get_queryset`` method to retrieve\nthe list of objects. If you want to add custom filters, sorting or site\nhandling, you can add a ``get_link_queryset`` method to the model admin::\n\n    class MyModelAdmin(admin.ModelAdmin):\n        def get_link_queryset(self, request, site_id):\n            \"\"\"Only used by djangocms-link: returns queryset to select link targets from.\"\"\"\n            qs = self.get_queryset(request)\n            return qs.filter(is_public=True)\n\nLarge search-sets\n..................\n\nIf you have a large number of internally linkable models, you can use the\n``DJANGOCMS_LINK_MINIMUM_INPUT_LENGTH`` setting to require a minimum number of\ncharacters typed before the search is triggered. The higher the number, the\nsmaller the average result set size. The default is 0::\n\n    # Require at least 2 characters to be typed before searching for pages\n    DJANGOCMS_LINK_MINIMUM_INPUT_LENGTH = 2\n\nBy default django CMS Link will paginate the search results. You can change the\npage size by setting the ``DJANGOCMS_LINK_PAGINATE_BY`` setting.\nThe default is 50::\n\n    # Show 100 results per \"page\"\n    DJANGOCMS_LINK_PAGINATE_BY = 100\n\nNote, that in the admin paginated search results repeat the model's verbose name.\n\n\nSite-selectors\n..............\n\nFor multi-site installations, django CMS Link provides a site selector. It can be\nswitched on or off by setting the ``DJANGOCMS_LINK_SITE_SELECTOR`` setting to\n``True`` or ``False``. The default is ``True``::\n\n    # Enable the site selector\n    DJANGOCMS_LINK_SITE_SELECTOR = True\n\nNon-standard hostnames\n......................\n\nTo support environments where non-standard URLs would otherwise work, this\nproject supports the defining of an additional RegEx pattern for validating the\nhost-portion of the URL.\n\nFor example:\n\n.. code-block:: python\n\n    # RFC1123 Pattern:\n    DJANGOCMS_LINK_INTRANET_HOSTNAME_PATTERN = r'[a-z,0-9,-]{1,15}'\n\nEither of these might accept a URL such as:\n\n.. code-block:: html\n\n    http://SEARCHHOST/?q=some+search+string\n\nIf left undefined, the normal Django URLValidator will be used.\n\n\nLink fields\n-----------\n\n*Added in version 5:*\n\ndjango CMS Link provides a re-usable link model field, form field and form\nwidget. This allows you to use the link field in your own models or admin forms.\n\n.. code-block:: python\n\n    from djangocms_link.fields import LinkField, LinkFormField, LinkWidget\n\n    class MyModel(models.Model):\n        link = LinkField()  # or LinkField(blank=True) for optional links\n\n    class MyForm(forms.Form):\n        link = LinkFormField(required=False)\n\n``LinkField`` is a subclass of ``JSONField`` and stores the link data as\n``djangocms_link.helpers.LinkDict``, a direct subclass of ``dict``.\n(An empty link will be ``{}``.)\n\nTo render the link field in a template, convert the ``LinkDict`` to string,\nuse the ``LinkDict`` property ``url`` or the new template tag ``to_url``.\nThe ``type`` property returns the link type::\n\n    {# Variant 1 #}\n    {% if obj.link %}\n        \u003ca href=\"{{ obj.link }}\"\u003eLink available\u003c/a\u003e  {# str(obj.link) gives the URL #}\n    {% endif %}\n\n    {# Variant 2 #}\n    {% if obj.link %}\n        \u003ca href=\"{{ obj.link.url }}\"\u003eLink\u003c/a\u003e  {# explicitly get the URL #}\n    {% endif %}\n\n    {% if obj.link.type == \"external_link\" %}  {# evaluate link type #}\n        \u003ca href=\"{{ obj.link.url }}\"\u003eExternal link\u003c/a\u003e\n    {% endif %}\n\n\nTo turn the ``LinkField``'s ``LinkDict`` dictionary into a URL in python code,\nuse the ``url`` property. (It will hit the database if needed. Results are\ncached.)::\n\n    obj = MyModel.objects.first()\n    url = obj.link.url\n\nLink models\n-----------\n\nThe ``to_url`` template filter and the ``get_obj_link`` helper function can be used to\nget the full url for any Django model instance. This is useful on multi-site installations.\n``to_url`` assumes that the model instance's site is found in its ``site`` property. If the\nmodel belongs to a different site than the current, it prepends the domain name of that site.\n\nExample::\n\n    {% load djangocms_link_tags %}\n\n    {% if obj %}\n        \u003ca href=\"{{ obj|to_url }}\"\u003eLink to object\u003c/a\u003e  {# will include the site domain if needed #}\n    {% endif %}\n\nRunning Tests\n-------------\n\nYou can run tests by executing::\n\n    virtualenv env\n    source env/bin/activate\n    pip install -r tests/requirements.txt\n    pytest\n\n\nUpgrading from version 4 or lower\n---------------------------------\n\ndjango CMS Link 5 is a rewrite of the plugin. If you are updating from\nversion 4 or lower, you will notice\n\n* the **new re-usable link widget**, greatly simplifying the user interface\n* an **improved management of multi-site situations**, essentially avoiding the\n  unnecessary additon of the host name to the URL in plugin instances that\n  are not in a page placeholder (such as links on aliases or static placeholder)\n* a **re-usable admin endpoint** for querying available links which can be used\n  by other apps such as djangocms-text.\n* Links are generated by template tags or template filters instead of the\n  model's ``get_link()`` method. This allows multiple links in future models. The\n  ``get_link()`` method on the plugin's model is still available for backwards\n  compatibility.\n\nMigrations should automatically existing plugin instances to the new model\nfields.\n\n**WARNING:** We strongly recommend to backup your database before updating to\nversion 5. The migration is tested but they do remove unused fields from\nthe database. If you encounter any issues, please report them on\n`GitHub \u003chttps://github.com/django-cms/djangocms-link/issues\u003e`_.\n\n.. |pypi| image:: https://badge.fury.io/py/djangocms-link.svg\n    :target: http://badge.fury.io/py/djangocms-link\n\n.. |coverage| image:: https://codecov.io/gh/django-cms/djangocms-link/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/django-cms/djangocms-link\n\n.. |python| image:: https://img.shields.io/pypi/pyversions/djangocms-link\n    :alt: PyPI - Python Version\n    :target: https://pypi.org/project/djangocms-link/\n\n.. |django| image:: https://img.shields.io/pypi/frameworkversions/django/djangocms-link\n    :alt: PyPI - Django Versions from Framework Classifiers\n    :target: https://www.djangoproject.com/\n\n.. |djangocms| image:: https://img.shields.io/pypi/frameworkversions/django-cms/djangocms-link\n    :alt: PyPI - django CMS Versions from Framework Classifiers\n    :target: https://www.django-cms.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjango-cms%2Fdjangocms-link","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjango-cms%2Fdjangocms-link","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjango-cms%2Fdjangocms-link/lists"}