Skip to content

Commit 6d7af0d

Browse files
fsbraunmarksweb
andauthored
feat: added re-usable Link widget and JSON endpoint (#229)
* feat: endpoint for urls, link widget * Update test action * Fix linting issues * More liniting * fix: v3 compatibility * Add two step select2 internal link widget * Fix linting issues * Fix tests and dependencies * Fix migration and link_is_optional * Remove unused blank parameter * Update changelog * feat: autodetect linkable models through their admin * Fix v3 compat with GrouperModelAdmin * Add tests for endpoint * Fix for v3 * Try again * Update codecov action * Fix test.yml syntax error * Update tests * Test template tags * Update validator tests * Update tag tests * Fix migration * Fix migration test and add tests for Django 5.1 * Update migration test for v3 * Remove test with Django 5.1 and django CMS 3.11 (since they are not compatible) * Add test for migration of anchor-only link. * Add tests for third-party app endpoints * Update translations * Add tests for link widget and compiled translations * Mark untestable lines * Simplified manager retrieval * Improved endpoint tests * Allow simplified setting ``DJANGOCMS_LINK_LINKABLE_MODELS``. * Recover django 4.2 compat * Update readme * Small simplification * Add a nocover for current tests * Update readme * Update classifiers * Add `to_link` template tag * Set correct default for empty link * Add ``DJANGOCMS_LINK_ALLOWED_LINK_TYPES`` config * feat: Allow for `get_link_queryset` method in model admin * Add `DJANGOCMS_LINK_MINIMUM_INPUT_LENGTH` setting * Update tests * Simplify site detection * Update README * remove legacy code * Remove more legacy code * Add some type annotations * Add no cover for an unreachable line in tests * Update README.rst * Update README.rst * Add link icon to plugin (for djangocms_text dropdown) * fix tests * fix: Empty model list not added to URL endpoint result * fix tests * Add `DJANGOCMS_LINK_PAGINATE_BY` setting * fix: LinkField defaulted to `blank=True` * Add static files to `MANIFEST.in` * Remove tests from installation * Optimize `Page` queryset * Fix: restore v3 compatibility * fix: Update GitHub action versions * fix: Run migration test * fix: Do not initialize `REGISTERED_ADMINS` with model setting * Update django-cms dependency * Avoid skipping the migration test * feat: LinkDict (syntactic sugar) * More detailed link types * feat: improve test coverage and use pytest * Update checkout action * Remove django-app-helper from dependencies * Move to pyproject.toml * fix license description in pyproject.toml * Update workflows * Fix flake8 action * Fix precommit flake8 * fix: Setuptools in py39 * Update README * Remove test debug code * add __str__ to LinkDict * Fix pyproject.toml, typo in Changelog * Fix README.rst * Update readme * Some clarifications in the README * One more readme clarification * Update pyproject.toml and tox.ini * Update .github/workflows/test.yml Co-authored-by: Mark Walker <mark.walker@realbuzz.com> * Move coverage config to pyproject.toml * Better slicing of endpoint querysets * Fix update tests --------- Co-authored-by: Mark Walker <mark.walker@realbuzz.com>
1 parent 3ada4aa commit 6d7af0d

File tree

233 files changed

+8097
-7988
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

233 files changed

+8097
-7988
lines changed

.coveragerc

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
with:
1515
python-version: 3.9
1616
- name: Install flake8
17-
run: pip install --upgrade flake8
17+
run: pip install --upgrade flake8 flake8-pyproject
1818
- name: Run flake8
1919
uses: liskin/gh-problem-matcher-wrap@v1
2020
with:

.github/workflows/test.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,45 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
python-version: [ "3.10", "3.11", "3.12"] # latest release minus two
11+
python-version: [ "3.9", "3.10", "3.11", "3.12"]
1212
requirements-file: [
1313
dj42_cms311.txt,
1414
dj42_cms41.txt,
1515
dj50_cms311.txt,
1616
dj50_cms41.txt,
17+
dj51_cms41.txt,
1718
]
1819
os: [
1920
ubuntu-20.04,
2021
]
22+
exclude:
23+
- requirements-file: dj50_cms311.txt
24+
python-version: 3.9
25+
- requirements-file: dj50_cms41.txt
26+
python-version: 3.9
27+
- requirements-file: dj51_cms311.txt
28+
python-version: 3.9
29+
- requirements-file: dj51_cms41.txt
30+
python-version: 3.9
2131

2232
steps:
23-
- uses: actions/checkout@v1
33+
- uses: actions/checkout@v4
2434
- name: Set up Python ${{ matrix.python-version }}
2535

26-
uses: actions/setup-python@v2
36+
uses: actions/setup-python@v5
2737
with:
2838
python-version: ${{ matrix.python-version }}
2939
- name: Install dependencies
3040
run: |
3141
python -m pip install --upgrade pip
42+
pip install -U setuptools
3243
pip install -r tests/requirements/${{ matrix.requirements-file }}
3344
python setup.py install
3445
35-
- name: Run coverage
36-
run: coverage run setup.py test
46+
- name: Run test coverage
47+
run: coverage run -m pytest
3748

3849
- name: Upload Coverage to Codecov
39-
uses: codecov/codecov-action@v1
50+
uses: codecov/codecov-action@v4
51+
with:
52+
token: ${{ secrets.CODECOV_TOKEN }} # required

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ repos:
2424
rev: 7.1.1
2525
hooks:
2626
- id: flake8
27+
additional_dependencies: [Flake8-pyproject]
2728

2829
- repo: https://github.com/pre-commit/pre-commit-hooks
2930
rev: v5.0.0
@@ -35,3 +36,16 @@ repos:
3536
rev: 5.13.2
3637
hooks:
3738
- id: isort
39+
40+
- repo: https://github.com/tox-dev/pyproject-fmt
41+
rev: v2.5.0
42+
hooks:
43+
- id: pyproject-fmt
44+
45+
- repo: https://github.com/rstcheck/rstcheck
46+
rev: v6.2.4
47+
hooks:
48+
- id: rstcheck
49+
additional_dependencies:
50+
- sphinx==6.1.3
51+
- tomli==2.0.1

.tx/config

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
[main]
22
host = https://www.transifex.com
33

4-
[djangocms-link.djangocms_link]
5-
file_filter = djangocms_link/locale/<lang>/LC_MESSAGES/django.po
6-
source_file = djangocms_link/locale/en/LC_MESSAGES/django.po
7-
source_lang = en
8-
type = PO
4+
[o:divio:p:djangocms-link:r:djangocms_link]
5+
file_filter = djangocms_link/locale/<lang>/LC_MESSAGES/django.po
6+
source_file = djangocms_link/locale/en/LC_MESSAGES/django.po
7+
source_lang = en
8+
type = PO
9+
replace_edited_strings = false
10+
keep_translations = false
11+

CHANGELOG.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,20 @@
22
Changelog
33
=========
44

5+
5.0.0 (unreleased)
6+
==================
7+
8+
* Major refactor
9+
* New re-usable LinkWidget, LinkFormField, and LinkField
10+
* New re-usable JSON endpoint for internal links
11+
* New template tags (``get_url`` tag and ``to_url`` filter) to convert link
12+
fields into URLs. This allows multiple LinkFields per model
13+
* Fixed cross-site linking which reduces the number situations of the hostname
14+
needing to be part of a link
15+
* Dropped django-select2 dependency in favor of django admin's autocomplete
16+
517
4.0.0 (2024-07-22)
6-
================
18+
==================
719

820
* Added support for django CMS 4.1
921
* Added support for python 3.10 to 3.12

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ include LICENSE
22
include README.rst
33
recursive-include djangocms_link/locale *
44
recursive-include djangocms_link/templates *
5+
recursive-include djangocms_link/static *
56
recursive-exclude * *.py[co]
7+
recursive-exclude tests *

0 commit comments

Comments
 (0)