Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:
name: docs
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.13'

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs/source/requirements.txt') }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.13'

- name: Ensure latest setuptools
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- name: Checkout
uses: actions/checkout@master

- name: Set up Python 3.9
uses: actions/setup-python@v1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.13'

- name: Ensure latest setuptools
run: python -m pip install --upgrade pip setuptools wheel
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- name: Checkout
uses: actions/checkout@master

- name: Set up Python 3.9
uses: actions/setup-python@v1
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.13'

- name: Ensure latest setuptools
run: |
Expand Down
23 changes: 13 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ jobs:
max-parallel: 5
matrix:
python-version:
- 3.7
- 3.8
- 3.9
- '3.10'
- '3.11'
- '3.12'
- '3.13'

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('test/example/requirements.txt') }}
Expand All @@ -42,14 +42,17 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade tox tox-py codecov
python -m pip install --upgrade tox tox-py coverage codecov-cli
sudo apt-get install gettext

- name: Run tox targets for ${{ matrix.python-version }}
run: |
tox --py current
coverage combine
coverage xml -o coverage.xml

- name: Coverage reporting
run: |
coverage combine
codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
verbose: true
35 changes: 35 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.13"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/source/requirements.txt
9 changes: 0 additions & 9 deletions MANIFEST.in

This file was deleted.

5 changes: 0 additions & 5 deletions comment/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import django

__version__ = '2.8.0'

Expand All @@ -22,7 +21,3 @@ def check_release():


check_release()


if django.VERSION < (3, 2):
default_app_config = 'comment.apps.CommentConfig'
4 changes: 2 additions & 2 deletions comment/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ def get_parent(obj):

@staticmethod
def get_replies(obj):
if obj.is_parent:
if obj.pk and obj.is_parent:
return CommentSerializer(obj.replies(), many=True).data
else:
return []

@staticmethod
def get_reply_count(obj):
if obj.is_parent:
if obj.pk and obj.is_parent:
return obj.replies().count()
else:
return 0
Expand Down
8 changes: 3 additions & 5 deletions comment/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@

_django_version = django.VERSION
DEPRECATED_SETTINGS = {
'PASSWORD_RESET_TIMEOUT_DAYS' if _django_version > (3, 0) else None,
'DEFAULT_CONTENT_TYPE' if _django_version > (2, 2) else None,
'FILE_CHARSET' if _django_version > (2, 2) else None,
'USE_L10N' if _django_version > (4, 0) else None,
'USE_TZ' if _django_version > (4, 0) else None,
'DEFAULT_FILE_STORAGE' if (4, 2) <= _django_version < (5, 1) else None,
'STATICFILES_STORAGE' if (4, 2) <= _django_version < (5, 1) else None,
'USE_L10N' if (4, 0) <= _django_version < (5, 0) else None,
}


Expand Down
4 changes: 2 additions & 2 deletions comment/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ def assertTextTranslated(self, text, url=None):
f'No translation for the text "{text}" from view {self.get_view_from_url_or_none(url)}'
)

def assertQuerysetEqual(self, qs, values, transform=None, ordered=True, msg=None):
def assertQuerySetEqual(self, qs, values, transform=None, ordered=True, msg=None):
if not transform:
def transform(x):
return x
return super().assertQuerysetEqual(qs, values, transform=transform, ordered=True, msg=msg)
return super().assertQuerySetEqual(qs, values, transform=transform, ordered=True, msg=msg)

def assert_permission_denied_response(self, response, reason=None):
forbidden_code = 403
Expand Down
9 changes: 6 additions & 3 deletions comment/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ def test_create_anonymous_comment_form(self):
self.assertEqual(email_field.label, EmailInfo.LABEL)
self.assertTextTranslated(email_field.label)
self.assertEqual(email_field.widget.input_type, field)
self.assertDictEqual(email_field.widget.attrs, {
expected_attrs = {
'placeholder': EmailInfo.INPUT_PLACEHOLDER,
'title': EmailInfo.INPUT_TITLE
})
'title': EmailInfo.INPUT_TITLE,
'maxlength': email_field.widget.attrs['maxlength']
}

self.assertDictEqual(email_field.widget.attrs, expected_attrs)

@patch.object(settings, 'COMMENT_ALLOW_ANONYMOUS', True)
def test_create_anonymous_comment_without_email(self):
Expand Down
4 changes: 2 additions & 2 deletions comment/tests/test_models/test_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,14 @@ def setUp(self):
self.all_comments_qs = Comment.objects.all_exclude_flagged()

def test_default_value(self):
self.assertQuerysetEqual(
self.assertQuerySetEqual(
Comment.objects._filter_parents(self.all_comments_qs),
self.all_parents_qs.order_by(*settings.COMMENT_ORDER_BY)
)

@patch.object(settings, 'COMMENT_ORDER_BY', ['-reaction__likes'])
def test_custom_values(self):
self.assertQuerysetEqual(
self.assertQuerySetEqual(
Comment.objects._filter_parents(self.all_comments_qs),
self.all_parents_qs.order_by(*settings.COMMENT_ORDER_BY)
)
Expand Down
7 changes: 7 additions & 0 deletions docs/source/Changelog.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
Changelog
=========
3.0.0
------
- Confirm support for Python ``3.11``, ``3.12``, ``3.13``.
- Confirm support for Django ``4.2``, ``5.0``, ``5.1``, ``5.2``.
- Remove support for Python ``3.6``, ``3.7``, ``3.8``, ``3.9``.
- Remove support for Django ``3.2``, ``4.0``.


2.8.0
------
Expand Down
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def get_version():
'sphinx.ext.githubpages',
'sphinx.ext.autosectionlabel',
'sphinxcontrib.swagger',
'sphinx_rtd_theme',
]

openapi = {
Expand Down
4 changes: 3 additions & 1 deletion docs/source/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
sphinxcontrib-swagger>=0.0.2
setuptools # sphninxcontrib-swagger requires setuptools
sphinxcontrib-swagger
sphinx_rtd_theme
74 changes: 72 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,73 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "django-comments-dab"
dynamic = ["version"]
description = "Django Comment app. It can be associated with any given model."
readme = "README.rst"
requires-python = ">=3.10"
license = "MIT"
keywords = ["django", "comment", "comments", "ajax"]
authors = [
{ name = "Radico", email = "mus.radi85@gmail.com" },
]
maintainers = [
{ name = "Radi Mustafa", email = "mus.radi85@gmail.com" },
]
classifiers = [
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
"Framework :: Django :: 5.2",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
]
dependencies = [
"django",
]

[project.optional-dependencies]
markdown = ["markdown"]

[project.urls]
Homepage = "https://github.com/radi85/Comment"
Documentation = "https://django-comment-dab.readthedocs.io/index.html"
"Source Code" = "https://github.com/radi85/Comment"

[tool.hatch.version]
path = "VERSION"
pattern = "(?P<version>.*)"

[tool.hatch.build.targets.wheel]
packages = ["comment"]
include = [
"comment/static/**/*",
"comment/templates/**/*",
"comment/locale/**/*",
]

[tool.hatch.build.targets.sdist]
include = [
"/comment",
"/VERSION",
"/README.rst",
"/LICENSE",
"/pyproject.toml",
]
exclude = [
"*.py[cod]",
"__pycache__",
"/comment/tests",
]
Loading
Loading