Skip to content

Commit

Permalink
feat: added re-usable Link widget and JSON endpoint (#229)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Move coverage config to pyproject.toml

* Better slicing of endpoint querysets

* Fix update tests

---------

Co-authored-by: Mark Walker <[email protected]>
  • Loading branch information
fsbraun and marksweb authored Nov 20, 2024
1 parent 3ada4aa commit 6d7af0d
Show file tree
Hide file tree
Showing 233 changed files with 8,097 additions and 7,988 deletions.
18 changes: 0 additions & 18 deletions .coveragerc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
python-version: 3.9
- name: Install flake8
run: pip install --upgrade flake8
run: pip install --upgrade flake8 flake8-pyproject
- name: Run flake8
uses: liskin/gh-problem-matcher-wrap@v1
with:
Expand Down
25 changes: 19 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,45 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.10", "3.11", "3.12"] # latest release minus two
python-version: [ "3.9", "3.10", "3.11", "3.12"]
requirements-file: [
dj42_cms311.txt,
dj42_cms41.txt,
dj50_cms311.txt,
dj50_cms41.txt,
dj51_cms41.txt,
]
os: [
ubuntu-20.04,
]
exclude:
- requirements-file: dj50_cms311.txt
python-version: 3.9
- requirements-file: dj50_cms41.txt
python-version: 3.9
- requirements-file: dj51_cms311.txt
python-version: 3.9
- requirements-file: dj51_cms41.txt
python-version: 3.9

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}

uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools
pip install -r tests/requirements/${{ matrix.requirements-file }}
python setup.py install
- name: Run coverage
run: coverage run setup.py test
- name: Run test coverage
run: coverage run -m pytest

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # required
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ repos:
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies: [Flake8-pyproject]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
Expand All @@ -35,3 +36,16 @@ repos:
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.5.0
hooks:
- id: pyproject-fmt

- repo: https://github.com/rstcheck/rstcheck
rev: v6.2.4
hooks:
- id: rstcheck
additional_dependencies:
- sphinx==6.1.3
- tomli==2.0.1
13 changes: 8 additions & 5 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
[main]
host = https://www.transifex.com

[djangocms-link.djangocms_link]
file_filter = djangocms_link/locale/<lang>/LC_MESSAGES/django.po
source_file = djangocms_link/locale/en/LC_MESSAGES/django.po
source_lang = en
type = PO
[o:divio:p:djangocms-link:r:djangocms_link]
file_filter = djangocms_link/locale/<lang>/LC_MESSAGES/django.po
source_file = djangocms_link/locale/en/LC_MESSAGES/django.po
source_lang = en
type = PO
replace_edited_strings = false
keep_translations = false

14 changes: 13 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,20 @@
Changelog
=========

5.0.0 (unreleased)
==================

* Major refactor
* New re-usable LinkWidget, LinkFormField, and LinkField
* New re-usable JSON endpoint for internal links
* New template tags (``get_url`` tag and ``to_url`` filter) to convert link
fields into URLs. This allows multiple LinkFields per model
* Fixed cross-site linking which reduces the number situations of the hostname
needing to be part of a link
* Dropped django-select2 dependency in favor of django admin's autocomplete

4.0.0 (2024-07-22)
================
==================

* Added support for django CMS 4.1
* Added support for python 3.10 to 3.12
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ include LICENSE
include README.rst
recursive-include djangocms_link/locale *
recursive-include djangocms_link/templates *
recursive-include djangocms_link/static *
recursive-exclude * *.py[co]
recursive-exclude tests *
Loading

0 comments on commit 6d7af0d

Please sign in to comment.