Skip to content

Commit 61267d0

Browse files
Merge branch 'develop'
2 parents 40bd3fb + 07528e7 commit 61267d0

40 files changed

+919
-428
lines changed

.bumpversion.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[bumpversion]
2+
commit = False
3+
tag = False
4+
current_version = 2.0.0
5+
6+
[bumpversion:file:setup.cfg]

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
[*.{scss,sass}]
11+
indent_size = 2
12+
13+
[*.{yml,yaml}]
14+
indent_size = 2

.github/workflows/ci.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Run CI
2+
3+
# Run this workflow every time a new commit pushed to your repository
4+
on:
5+
push:
6+
branches:
7+
- master
8+
- develop
9+
tags:
10+
- '*'
11+
pull_request:
12+
workflow_dispatch:
13+
14+
jobs:
15+
tests:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
python: ['3.7', '3.8', '3.9', '3.10']
20+
django: ['2.2', '3.2']
21+
22+
services:
23+
postgres:
24+
image: postgres:12
25+
env:
26+
POSTGRES_HOST_AUTH_METHOD: trust
27+
ports:
28+
- 5432:5432
29+
# Needed because the postgres container does not provide a healthcheck
30+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
31+
32+
name: Run the test suite (Python ${{ matrix.python }}, Django ${{ matrix.django }})
33+
34+
steps:
35+
- uses: actions/checkout@v2
36+
- uses: actions/setup-python@v2
37+
with:
38+
python-version: ${{ matrix.python }}
39+
40+
- name: Install dependencies
41+
run: pip install tox tox-gh-actions codecov
42+
43+
- name: Run tests
44+
run: |
45+
export TOXENV=py${PYTHON_VERSION/./}-django${DJANGO/./}
46+
tox
47+
codecov -e TOXENV,DJANGO --file reports/coverage-${TOXENV}.xml
48+
env:
49+
PYTHON_VERSION: ${{ matrix.python }}
50+
DJANGO: ${{ matrix.django }}
51+
PGHOST: localhost
52+
53+
- name: Publish coverage report
54+
uses: codecov/codecov-action@v1
55+
56+
publish:
57+
name: Publish package to PyPI
58+
runs-on: ubuntu-latest
59+
needs: tests
60+
61+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
62+
63+
steps:
64+
- uses: actions/checkout@v2
65+
- uses: actions/setup-python@v2
66+
with:
67+
python-version: '3.8'
68+
69+
- name: Build sdist and wheel
70+
run: |
71+
pip install pip setuptools wheel --upgrade
72+
python setup.py sdist bdist_wheel
73+
74+
- name: Publish a Python distribution to PyPI
75+
uses: pypa/[email protected]
76+
with:
77+
user: __token__
78+
password: ${{ secrets.PYPI_TOKEN }}

.github/workflows/code_quality.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Code quality checks
2+
3+
# Run this workflow every time a new commit pushed to your repository
4+
on:
5+
push:
6+
branches:
7+
- master
8+
- develop
9+
tags:
10+
paths:
11+
- '**.py'
12+
pull_request:
13+
paths:
14+
- '**.py'
15+
workflow_dispatch:
16+
17+
jobs:
18+
linting:
19+
name: Code-quality checks
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
toxenv: [isort, black]
24+
steps:
25+
- uses: actions/checkout@v2
26+
- uses: actions/setup-python@v2
27+
with:
28+
python-version: '3.7'
29+
- name: Install dependencies
30+
run: pip install tox
31+
- run: tox
32+
env:
33+
TOXENV: ${{ matrix.toxenv }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ coverage.xml
4646
cover/*
4747
.hypothesis/
4848
junit*.xml
49+
reports/
4950

5051
# Translations
5152
*.pot

.travis.yml

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

README.rst

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,19 @@ django-timeline-logger
44

55
A reusable Django app to log actions and display them in a timeline
66

7-
.. image:: https://travis-ci.org/maykinmedia/django-timeline-logger.svg?branch=master
8-
:target: https://travis-ci.org/maykinmedia/django-timeline-logger
9-
10-
.. image:: https://codecov.io/gh/maykinmedia/django-timeline-logger/branch/develop/graph/badge.svg
11-
:target: https://codecov.io/gh/maykinmedia/django-timeline-logger
12-
13-
.. image:: https://badge.fury.io/py/django-timeline-logger.svg
14-
:target: https://badge.fury.io/py/django-timeline-logger
7+
|build-status| |code-quality| |coverage| |black|
158

9+
|python-versions| |django-versions| |pypi-version|
1610

1711
Prerequisites
1812
=============
1913

20-
This project uses `django.contrib.postgres.JSONField`, and as such, you need:
14+
This project uses ``django.contrib.postgres.JSONField``, and as such, you need:
2115

22-
* at least Django 1.11
23-
* at least PostgreSQL 9.4
16+
* at least Django 2.2+
17+
* at least PostgreSQL 10
2418
* at least psycopg2 2.5.4
19+
* A modern setuptools version
2520

2621

2722
Installation
@@ -66,3 +61,26 @@ Documentation
6661
The extended documentation is available on `Read the Docs`_.
6762

6863
.. _Read the Docs: http://django-timeline-logger.readthedocs.io/en/latest/
64+
65+
66+
.. |build-status| image:: https://github.com/maykinmedia/django-timeline-logger/actions/workflows/ci.yml/badge.svg
67+
:alt: Build status
68+
:target: https://github.com/maykinmedia/django-timeline-logger/actions/workflows/ci.yml
69+
70+
.. |code-quality| image:: https://github.com/maykinmedia/django-timeline-logger/actions//workflows/code_quality.yml/badge.svg
71+
:alt: Code quality checks
72+
:target: https://github.com/maykinmedia/django-timeline-logger/actions//workflows/code_quality.yml
73+
74+
.. |coverage| image:: https://codecov.io/gh/maykinmedia/django-timeline-logger/branch/master/graph/badge.svg
75+
:target: https://codecov.io/gh/maykinmedia/django-timeline-logger
76+
:alt: Coverage status
77+
78+
.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
79+
:target: https://github.com/psf/black
80+
81+
.. |python-versions| image:: https://img.shields.io/pypi/pyversions/django-timeline-logger.svg
82+
83+
.. |django-versions| image:: https://img.shields.io/pypi/djversions/django-timeline-logger.svg
84+
85+
.. |pypi-version| image:: https://img.shields.io/pypi/v/django-timeline-logger.svg
86+
:target: https://pypi.org/project/django-timeline-logger/

demo/demo/settings.py

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,72 +15,70 @@
1515
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
1616
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
1717

18-
SECRET_KEY = 'such-secret-much-hiding-wow'
18+
SECRET_KEY = "such-secret-much-hiding-wow"
1919

2020
# SECURITY WARNING: don't run with debug turned on in production!
2121
DEBUG = True
2222

23-
ALLOWED_HOSTS = ['*']
23+
ALLOWED_HOSTS = ["*"]
2424

2525

2626
# Application definition
2727

2828
INSTALLED_APPS = [
29-
'django.contrib.admin',
30-
'django.contrib.auth',
31-
'django.contrib.contenttypes',
32-
'django.contrib.sessions',
33-
'django.contrib.messages',
34-
'django.contrib.staticfiles',
35-
36-
'import_export',
37-
'timeline_logger',
38-
39-
'demo_app.apps.DemoAppConfig',
29+
"django.contrib.admin",
30+
"django.contrib.auth",
31+
"django.contrib.contenttypes",
32+
"django.contrib.sessions",
33+
"django.contrib.messages",
34+
"django.contrib.staticfiles",
35+
"import_export",
36+
"timeline_logger",
37+
"demo_app.apps.DemoAppConfig",
4038
]
4139

4240
MIDDLEWARE = [
43-
'django.middleware.security.SecurityMiddleware',
44-
'django.contrib.sessions.middleware.SessionMiddleware',
45-
'django.middleware.common.CommonMiddleware',
46-
'django.middleware.csrf.CsrfViewMiddleware',
47-
'django.contrib.auth.middleware.AuthenticationMiddleware',
48-
'django.contrib.messages.middleware.MessageMiddleware',
49-
'django.middleware.clickjacking.XFrameOptionsMiddleware',
41+
"django.middleware.security.SecurityMiddleware",
42+
"django.contrib.sessions.middleware.SessionMiddleware",
43+
"django.middleware.common.CommonMiddleware",
44+
"django.middleware.csrf.CsrfViewMiddleware",
45+
"django.contrib.auth.middleware.AuthenticationMiddleware",
46+
"django.contrib.messages.middleware.MessageMiddleware",
47+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
5048
]
5149

52-
ROOT_URLCONF = 'demo.urls'
50+
ROOT_URLCONF = "demo.urls"
5351

5452
TEMPLATES = [
5553
{
56-
'BACKEND': 'django.template.backends.django.DjangoTemplates',
57-
'DIRS': [],
58-
'APP_DIRS': True,
59-
'OPTIONS': {
60-
'context_processors': [
61-
'django.template.context_processors.debug',
62-
'django.template.context_processors.request',
63-
'django.contrib.auth.context_processors.auth',
64-
'django.contrib.messages.context_processors.messages',
54+
"BACKEND": "django.template.backends.django.DjangoTemplates",
55+
"DIRS": [],
56+
"APP_DIRS": True,
57+
"OPTIONS": {
58+
"context_processors": [
59+
"django.template.context_processors.debug",
60+
"django.template.context_processors.request",
61+
"django.contrib.auth.context_processors.auth",
62+
"django.contrib.messages.context_processors.messages",
6563
],
6664
},
6765
},
6866
]
6967

70-
WSGI_APPLICATION = 'demo.wsgi.application'
68+
WSGI_APPLICATION = "demo.wsgi.application"
7169

7270

7371
# Database
7472
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
7573

7674
DATABASES = {
77-
'default': {
78-
'ENGINE': 'django.db.backends.postgresql',
79-
'NAME': os.getenv('PGDATABASE', 'timeline_logger'),
80-
'USER': os.getenv('PGUSER', 'postgres'),
81-
'PASSWORD': os.getenv('PGPASSWORD', ''),
82-
'HOST': os.getenv('PGHOST', ''),
83-
'PORT': os.getenv('PGPORT', 5432),
75+
"default": {
76+
"ENGINE": "django.db.backends.postgresql",
77+
"NAME": os.getenv("PGDATABASE", "timeline_logger"),
78+
"USER": os.getenv("PGUSER", "postgres"),
79+
"PASSWORD": os.getenv("PGPASSWORD", ""),
80+
"HOST": os.getenv("PGHOST", ""),
81+
"PORT": os.getenv("PGPORT", 5432),
8482
}
8583
}
8684

@@ -90,26 +88,26 @@
9088

9189
AUTH_PASSWORD_VALIDATORS = [
9290
{
93-
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
91+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
9492
},
9593
{
96-
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
94+
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
9795
},
9896
{
99-
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
97+
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
10098
},
10199
{
102-
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
100+
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
103101
},
104102
]
105103

106104

107105
# Internationalization
108106
# https://docs.djangoproject.com/en/1.11/topics/i18n/
109107

110-
LANGUAGE_CODE = 'en-us'
108+
LANGUAGE_CODE = "en-us"
111109

112-
TIME_ZONE = 'UTC'
110+
TIME_ZONE = "UTC"
113111

114112
USE_I18N = True
115113

@@ -121,4 +119,4 @@
121119
# Static files (CSS, JavaScript, Images)
122120
# https://docs.djangoproject.com/en/1.11/howto/static-files/
123121

124-
STATIC_URL = '/static/'
122+
STATIC_URL = "/static/"

demo/demo/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
from django.contrib import admin
1818

1919
urlpatterns = [
20-
url(r'^admin/', admin.site.urls),
20+
url(r"^admin/", admin.site.urls),
2121
]

demo/demo_app/admin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
from import_export.admin import ExportMixin
44
from import_export.formats import base_formats
55
from import_export_xml.formats import XML
6-
from timeline_logger.models import TimelineLog
6+
77
from timeline_logger.admin import TimelineLogAdmin
8+
from timeline_logger.models import TimelineLog
89
from timeline_logger.resources import TimelineLogResource
910

1011
admin.site.unregister(TimelineLog)

0 commit comments

Comments
 (0)