forked from torchbox/wagtaildraftsharing
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Wagtail 6 support + extra way to create a sharing link #1
Merged
Merged
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
f933896
Add missing migration for change to 'editable' attr of created_by field
stevejalim 4b1af63
Make draftsharing menu position customisable
stevejalim 819fffa
Change menu icon
stevejalim f075a9d
Make draftsharing verbose names customisable
stevejalim c22b58b
Support current draftsharing behaviour in Wagtail 6
stevejalim 49af612
Add an option in the main Page menu to create a draftsharing link
stevejalim 5619783
Update README with new screenshot + make links relative
stevejalim 7b1a34a
Expand test coverage for SharingLinkView
stevejalim 003f678
Expand test coverage around expiry of links and setting expiry time d…
stevejalim c133b19
Move link expiry setting into app-level settings
stevejalim 6c8bf77
Expand test coverage: access to view to create a sharing link
stevejalim 6d395e8
Expand view test to 100% coverage
stevejalim ff0b469
Refactor view tests to split into focused TestCases now that we have …
stevejalim 127802d
Rename snippet class to improve code comprehension a tiny bit
stevejalim d4381d8
Add tests for model methods
stevejalim 9f1ffa6
Naming and formatting tweaks
stevejalim 9e9e444
Add comments to help understanding
stevejalim cf7dfa3
Expand model test coverage to 100%; fixup test regression due to code…
stevejalim 3172d68
Add tests for wagtail_hooks
stevejalim 828b0f1
Update gitignore to skip build artifacts and coverage reports
stevejalim 897adee
Address outlier case where, with Wagtail 5.1, the active_until field …
stevejalim b677cb9
Update tox to cover more versions of Python, Wagtail and Django
stevejalim 33035b9
Fix unused import
stevejalim 8cbe7bc
Switch to only using ruff, not black + isort + ruff
stevejalim 56f5db0
Formatting fixups with ruff (only)
stevejalim d61c5bb
Remove redundant isort config
stevejalim bf09190
Add GHA for CI; drop 3.8 support
stevejalim 91f78be
Stabilise tests across Python 3.9 and/or Wagtail 5.1 by enforcing UTC…
stevejalim 99a2e7a
Update ruff config with known sort order
stevejalim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: "CI" # Note that this name appears in the README's badge | ||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
pull_request: | ||
# Placeholder for the future if this work gets accepted into the upstream repo | ||
# release: | ||
# types: [published] | ||
|
||
jobs: | ||
run-tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: | ||
- '3.9' | ||
- '3.10' | ||
- '3.11' | ||
- '3.12' | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install .'[testing]' | ||
- name: Test with tox | ||
run: tox | ||
|
||
# Placeholder for the future if this work gets accepted into the upstream repo | ||
# release: | ||
# name: Release to PyPI | ||
# if: github.event_name == 'release' && github.event.action == 'published' | ||
# needs: | ||
# - run-tests | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - uses: actions/setup-python@v5 | ||
# with: | ||
# python-version: 3.11 | ||
# - name: Install dependencies for package building only | ||
# run: pip install build | ||
# - name: Build package for upload to PyPI | ||
# run: python -m build . | ||
# - name: Upload the distribution to PyPI | ||
# uses: pypa/[email protected] | ||
# with: | ||
# user: __token__ | ||
# password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,6 @@ | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 23.1.0 | ||
hooks: | ||
- id: black | ||
args: ["wagtaildraftsharing", "setup.py", "testmanage.py", "--line-length=79"] | ||
exclude: migrations | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: v0.0.254 | ||
rev: v0.6.9 | ||
hooks: | ||
- id: ruff | ||
exclude: migrations | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
name: isort (python) | ||
args: ["wagtaildraftsharing"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ name = "wagtaildraftsharing" | |
version = "0.0.4" | ||
description = "Share wagtail drafts with private URLs." | ||
readme = "README.md" | ||
requires-python = ">=3.8" | ||
requires-python = ">=3.9" | ||
license = {text = "CC0"} | ||
authors = [ | ||
{name = "Shohan Dutta Roy", email = "[email protected]" } | ||
|
@@ -15,8 +15,10 @@ classifiers = [ | |
"Framework :: Django", | ||
"Framework :: Django :: 3.2", | ||
"Framework :: Django :: 4.2", | ||
"Framework :: Django :: 5.1", | ||
"Framework :: Wagtail", | ||
"Framework :: Wagtail :: 5", | ||
"Framework :: Wagtail :: 6", | ||
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", | ||
"License :: Public Domain", | ||
"Programming Language :: Python", | ||
|
@@ -26,7 +28,9 @@ classifiers = [ | |
[project.optional-dependencies] | ||
testing = [ | ||
"coverage[toml]", | ||
"tox", | ||
"wagtail-factories", | ||
"freezegun==1.5.1", | ||
] | ||
|
||
[project.urls] | ||
|
@@ -44,42 +48,6 @@ inventory = [ | |
"static/wagtaildraftsharing/*", | ||
] | ||
|
||
[tool.black] | ||
line-length = 79 | ||
target-version = ["py38"] | ||
include = '\.pyi?$' | ||
exclude = ''' | ||
( | ||
/( | ||
\.eggs | ||
| \.git | ||
| \.tox | ||
| \*.egg-info | ||
| _build | ||
| build | ||
| dist | ||
| migrations | ||
)/ | ||
) | ||
''' | ||
|
||
[tool.isort] | ||
profile = "black" | ||
line_length = 79 | ||
lines_after_imports = 2 | ||
skip = [".tox", "migrations", ".venv", "venv"] | ||
known_django = ["django"] | ||
known_wagtail = ["wagtail"] | ||
default_section = "THIRDPARTY" | ||
sections = [ | ||
"STDLIB", | ||
"DJANGO", | ||
"WAGTAIL", | ||
"THIRDPARTY", | ||
"FIRSTPARTY", | ||
"LOCALFOLDER" | ||
] | ||
|
||
[tool.ruff] | ||
exclude = [ | ||
".git", | ||
|
@@ -90,6 +58,8 @@ exclude = [ | |
".venv", | ||
"venv", | ||
] | ||
|
||
[lint] | ||
ignore = [] | ||
select = [ | ||
"E", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
wagtaildraftsharing/migrations/0002_alter_wagtaildraftsharinglink_created_by.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 4.2.16 on 2024-10-01 14:32 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
("wagtaildraftsharing", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="wagtaildraftsharinglink", | ||
name="created_by", | ||
field=models.ForeignKey( | ||
blank=True, | ||
editable=False, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="+", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you get rid of this you'll want to make sure ruff has the appropriate config for sorting imports, e.g.
lint.isort.known-first-party
,lint.isort.section-order
, and/orlint.isort.sections.django
.