Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Oct 27, 2024
1 parent 3895f46 commit 0d3e335
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
10 changes: 10 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Linkable models
By default, django CMS Link will autodetect which Django or Django CMS models it
can create internal links to. To make a model appear in the list of internal
links, you need to

* register a model admin for the model and provide a ``search_fields``
attribute. django CMS Link uses the same search logic as the Django admin.
* provide a ``get_absolute_url()`` method on the model. This method should
Expand Down Expand Up @@ -162,6 +163,15 @@ To render the link field in a template, use the new template tags::
<a href="{{ url }}">Link available</a>
{% endif %}

To turn the ``LinkField``'s dictionary into a URL in python code, use the
``djangocms_link.helpers.get_link`` helper function::

from djangocms_link.helpers import get_link

obj = MyModel.objects.first()
url = get_link(obj.link)


Running Tests
-------------

Expand Down
1 change: 1 addition & 0 deletions djangocms_link/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class SiteAutocompleteSelect(AutocompleteSelect):

def __init__(self, attrs=None):
# Hack: Pretend that the user is selecting a site for a Page object
# and use Django admin's autocomplete widget
try:
from cms.models.pagemodel import TreeNode

Expand Down
Binary file modified preview.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 6 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@
envlist =
flake8
isort
py{38,39,310}-dj{32}-cms{310,311}
py{38,39,310}-dj{40}-cms{311}
py{39,310}-dj{40,42}-cms{41}
py{39,310,311}-dj{42}-cms{311}
py{310,311,312}-dj{42,50,51}-cms{41}

skip_missing_interpreters=True

[testenv]
deps =
-r{toxinidir}/tests/requirements/base.txt
dj32: Django>=3.2,<4.0
dj40: Django>=4.0,<4.1
dj42: Django>=4.2,<5.0
cms310: django-cms>=3.10,<3.11
cms311: django-cms>=3.11,<3.12
dj50: Django>=5.0,<5.1
dj51: Django>=5.1,<5.2
cms311: django-cms>=3.11,<4
cms41: django-cms>=4.1,<4.2
commands =
{envpython} --version
{env:COMMAND:coverage} erase
{env:COMMAND:coverage} run setup.py test
{env:COMMAND:coverage} run {toxinidir}/tests/settings.py
{env:COMMAND:coverage} report

[testenv:flake8]
Expand Down

0 comments on commit 0d3e335

Please sign in to comment.