Skip to content

Commit 72f3df4

Browse files
authored
Merge pull request #25 from jamesvandyne/django-40-compatibility
Django 4.0 Compatibility
2 parents e0937a2 + c0ab347 commit 72f3df4

File tree

6 files changed

+96
-23
lines changed

6 files changed

+96
-23
lines changed

CHANGELOG.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [3.0.0] - 2023-01-03
8+
### Added
9+
- Support for Django 4.0+
10+
11+
### Removed
12+
- Support for Django versions less than 2.2
13+
- Support for Python versions less than 3.7
14+
15+
## [2.0.2] - 2021-02-14
16+
### Fixed
17+
- Store source content as a string rather than a bytes object
18+
19+
## [2.0.1] - 2020-08-25
20+
### Fixed
21+
- Render HTML links in the Django admin by using `format_html` instead of the now-deprecated `allow_tags` attribute
22+
23+
## [2.0.0] - 2020-08-20
24+
### Removed
25+
- Support for Python 3.5
26+
27+
### Added
28+
- Compatibility in the `include_webmention_information` decorator for versions of Django with new-style middleware
29+
30+
## [1.1.0] - 2019-07-22
31+
### Changed
32+
- Use static `setup.cfg` for package metadata and tooling configuration
33+
- Use black code style
34+
- Lint with pyflakes
35+
36+
## [1.0.1] - 2018-04-12
37+
### Fixed
38+
- Made `setup.py` aware that the README content type is, in fact, markdown
39+
40+
## [1.0.0] - 2018-04-12
41+
### Added
42+
- Better documentation about testing
43+
- Coverage configuration
44+
45+
### Changed
46+
- Use markdown for PyPI README
47+
48+
## [0.1.0] - 2018-01-02
49+
### Added
50+
- Mention use of `path()` over `url()` in README
51+
- Mention use of new-style `MIDDLEWARE` over old-style `MIDDLEWARE_CLASSES` in README
52+
- Add system check to detect presence of incorrect middleware configuration
53+
- Update imports and other syntax for forward compatibility with Django 1.10+ and Django 2.0+
54+
55+
## [0.0.4] - 2016-07-15
56+
### Changed
57+
- Reworked the unit tests to be runnable under Travis CI to support continuous integration
58+
59+
## [0.0.3] - 2016-01-22
60+
### Changed
61+
- Successful POST requests will now receive a 202 Accepted response rather than a 200 OK response
62+
63+
### Added
64+
- Django 1.9 in frameworks listed in setup.py
65+
66+
### Fixed
67+
- Errors in documentation
68+
69+
## [0.0.2] - 2015-07-11
70+
### Added
71+
- Webmentions are now available for review in the admin console
72+
- Webmentions are now updated or invalidated when a new webmention notification request is sent
73+
- Thorough unit testing
74+
75+
## [0.0.1] - 2015-07-10
76+
### Added
77+
- Pre-alpha initial release

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ This package does not currently provide functionality for [sending webmentions](
2121
* Add `'webmention'` to `INSTALLED_APPS`
2222
* Run `python manage.py migrate webmention`
2323
* Add the URL patterns to your top-level `urls.py`
24-
* `path('webmention/', include('webmention.urls'))` for Django >= 2.0
25-
* `url(r'^webmention', include('webmention.urls', namespace='webmention'))` for Django < 2.0
24+
* `path('webmention/', include('webmention.urls'))` for Django >= 3.2
2625

2726
## Usage
2827

2928
* Include webmention information by either:
3029
* Installing the middleware in `settings.py` (affects all views)
31-
* Use `webmention.middleware.webmention_middleware` in `MIDDLEWARE` for Django >= 1.10
32-
* Use `webmention.middleware.WebMentionMiddleware` in `MIDDLEWARE_CLASSES` for older projects
30+
* Append `webmention.middleware.webmention_middleware` to your `MIDDLEWARE` settings
3331
* Decorating a specific view with `webmention.middleware.include_webmention_information`
3432
* View webmention responses in the Django admin interface and mark them as reviewed as needed
3533

setup.cfg

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = django-webmention
3-
version = 2.0.2
3+
version = 3.0.0
44
description = A pluggable implementation of webmention for Django projects
55
author = Dane Hillard
66
author_email = [email protected]
@@ -13,17 +13,19 @@ classifiers =
1313
Development Status :: 5 - Production/Stable
1414
Intended Audience :: Developers
1515
Framework :: Django
16-
Framework :: Django :: 2.2
17-
Framework :: Django :: 3.0
18-
Framework :: Django :: 3.1
16+
Framework :: Django :: 3.2
17+
Framework :: Django :: 4.0
18+
Framework :: Django :: 4.1
1919
Topic :: Internet :: WWW/HTTP :: Indexing/Search
2020
License :: OSI Approved :: MIT License
2121
Programming Language :: Python
2222
Programming Language :: Python :: 3 :: Only
2323
Programming Language :: Python :: 3
24-
Programming Language :: Python :: 3.6
2524
Programming Language :: Python :: 3.7
2625
Programming Language :: Python :: 3.8
26+
Programming Language :: Python :: 3.9
27+
Programming Language :: Python :: 3.10
28+
Programming Language :: Python :: 3.11
2729

2830
[options]
2931
package_dir = =src
@@ -69,16 +71,16 @@ python_files =
6971
addopts = -ra -q --cov=webmention
7072

7173
[tox:tox]
72-
envlist = {py36,py37,py38}-django{2.2,3.0,3.1}
74+
envlist = {py37,py38,py39,py310,py311}-django{3.2,4.0,4.1}
7375

7476
[testenv]
7577
extras = test
7678
commands =
7779
pytest {posargs}
7880
deps =
79-
django2.2: Django>=2.2,<2.3
80-
django3.0: Django>=3.0,<3.1
81-
django3.1: Django>=3.1,<3.2
81+
django3.1: Django>=3.2,<3.3
82+
django4.0: Django>=4.0,<4.1
83+
django4.1: Django>=4.1,<4.2
8284

8385
[testenv:lint]
8486
extras = lint

src/webmention/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from django.conf.urls import url
1+
from django.urls import re_path
22

33
from . import views
44

55

66
app_name = "webmention"
77

88

9-
urlpatterns = [url(r"^receive$", views.receive, name="receive")]
9+
urlpatterns = [re_path(r"^receive$", views.receive, name="receive")]

tests/test_middleware.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@
22

33
import pytest
44

5-
try:
6-
from django.core.urlresolvers import reverse
7-
except ImportError:
8-
from django.urls import reverse
9-
5+
from django.urls import reverse
106
from django.http import HttpResponse
117

128
from webmention.middleware import WebMentionMiddleware
139

1410

1511
@pytest.fixture
1612
def middleware():
17-
return WebMentionMiddleware()
13+
return WebMentionMiddleware(get_response=Mock())
1814

1915

2016
def test_process_request_creates_link_header(middleware):

tests/test_urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from django.conf.urls import url, include
1+
from django.urls import re_path, include
22

3-
urlpatterns = [url(r"^webmention", include("webmention.urls", namespace="webmention"))]
3+
urlpatterns = [re_path(r"^webmention", include("webmention.urls", namespace="webmention"))]

0 commit comments

Comments
 (0)