Skip to content

Commit

Permalink
Merge branch 'release/0.3.79' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Nov 20, 2024
2 parents cf79d3c + 8da7c61 commit 9b10243
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[run]
include = edc_model_admin/*
omit = edc_model_admin/tests/*,edc_model_admin/migrations/*
branch = 1
branch = 1
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.12']
django-version: ['4.2', '5.0', '5.1', 'dev']
python-version: ['3.12', '3.13']
django-version: ['5.1', 'dev']
database-engine: ["mysql", "postgres"]

services:
mysql:
image: mysql:latest
Expand Down Expand Up @@ -68,7 +69,6 @@ jobs:
python -m pip install --upgrade pip
python -m pip install -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/tox.txt
- name: Tox tests
run: |
tox -v
Expand Down
23 changes: 13 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ exclude: tests/etc/user-*

repos:
- repo: https://github.com/PyCQA/bandit
rev: 1.7.7
rev: 1.7.10
hooks:
- id: bandit
args:
- "-x *test*.py"

- repo: https://github.com/psf/black
rev: 24.2.0
rev: 24.10.0
hooks:
- id: black
language_version: python3.11
language_version: python3.12

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8
args:
Expand All @@ -28,21 +28,24 @@ repos:
- id: isort

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: requirements-txt-fixer
files: requirements/.*\.txt$
- id: trailing-whitespace
- id: check-added-large-files
- id: fix-byte-order-marker
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: requirements-txt-fixer
files: requirements/.*\.txt$
- id: trailing-whitespace

- repo: https://github.com/adrienverge/yamllint
rev: v1.34.0
rev: v1.35.1
hooks:
- id: yamllint
args:
Expand Down
3 changes: 3 additions & 0 deletions edc_model_admin/mixins/model_admin_next_url_redirect_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ def get_next_redirect_url(self, request=None, **kwargs) -> Optional[str]:
except NoReverseMatch:
# raise with first exception msg
raise ModelAdminNextUrlRedirectError(msg)
else:
if "q" in options and "changelist" in url_name:
redirect_url = f"{redirect_url}?q={options['q']}"
return redirect_url

def get_savenext_redirect_url(self, request=None, obj=None) -> Optional[str]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@
}
.btn-live{color:#fff;background-color:#00C853}
.btn-test{color:#fff;background-color:#EF5350}

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
{% load i18n admin_urls static admin_list edc_admin_modify %}

{% block extrahead %}{{ block.super }}
<meta charset="utf-8">
<!-- begin edc_model extrahead -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="{% static 'fontawesomefree/js/all.min.js' %}"></script>
<!-- end edc_model extrahead -->
{% endblock %}

{% block extrastyle %}{{ block.super }}
Expand Down Expand Up @@ -35,4 +37,3 @@
{% block pagination %}{{ block.super }}{% if change_list_help %}<p style="width:80%">{{ change_list_help }}</p>{% endif %}{% endblock %}

{% block content %}{{ block.super }}{% revision_row %}{% endblock content %}

13 changes: 13 additions & 0 deletions edc_model_admin/templates/logout_row.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@


<form id="logout_form" method="post" action="{% url 'edc_auth_admin:logout' %}">{% csrf_token %}</form>

{% if perms.edc_navbar.nav_pharmacy_section %}
<a class="btn btn-toolbar" href="{% url 'edc_pharmacy:home_url' %}" aria-label="{% translate 'Pharmacy' %}" title="{% translate 'Pharmacy' %}"><i class="fa-solid fa-prescription fa-fw"></i></a> |
{% endif %}

{% if perms.edc_data_manager.nav_data_manager_section %}
<strong><a class="btn btn-toolbar" href="{% url 'edc_data_manager:home_url' %}" aria-label="{% translate 'Data management' %}" title="{% translate 'Data management' %}">DM</a></strong> |
{% endif %}

{% if perms.edc_adverse_event.nav_ae_section %}
<strong><a class="btn btn-toolbar" href="{% url 'edc_adverse_event:ae_home_url' %}" aria-label="{% translate 'Adverse events' %}" title="{% translate 'Adverse events' %}">AE</a></strong> |
{% endif %}

<a class="btn btn-toolbar" href="/" aria-label="{% translate 'Home' %}" title="{% translate 'Home' %}"><i class="fa-solid fa-home fa-fw"></i></a> |
{% if site_url %}
<a class="btn btn-toolbar" href="{{ site_url }}" title="{% translate 'Administration' %}" aria-label="{% translate 'Administration' %}"><i class="fa-solid fa-gear fa-fw"></i></a> |
Expand Down
1 change: 1 addition & 0 deletions edc_model_admin/templatetags/edc_admin_modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def edc_submit_row(
@register.inclusion_tag("logout_row.html", takes_context=True)
def logout_row(context):
return dict(
perms=context.get("perms"),
user=context.get("request").user,
request=context.get("request"),
site_url=context.get("site_url"),
Expand Down
39 changes: 25 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
[build-system]
requires = ["setuptools>=60", "setuptools-scm>=8.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
version_file="_version.py"
version_file = "_version.py"

[tool.black]
line-length = 95
target-version = ["py311"]
target-version = ["py312"]
extend-exclude = '''^(.*\/)*\b(migrations)\b($|\/.*$)'''

[tool.isort]
profile = "black"
py_version = "311"
py_version = "312"
skip = [".tox", ".eggs", "migrations"]

[tool.coverage.run]
Expand All @@ -35,35 +36,33 @@ exclude_lines = [
legacy_tox_ini = """
[tox]
envlist =
py{311}-dj{42,50},
py{312}-dj{50,dev},
py{312,313}-dj{51,dev},
lint
pre-commit
isolated_build = true
[gh-actions]
python =
3.11: py311
3.12: py312, lint
3.12: py312, lint, pre-commit
3.13: py313
[gh-actions:env]
DJANGO =
4.2: dj42
5.0: dj50
dev: djdev, lint
5.1: dj51
dev: djdev, lint, pre-commit
[testenv]
deps =
-r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/tox.txt
-r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/test_utils.txt
-r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/edc.txt
-r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/third_party_dev.txt
dj42: Django>=4.2,<5.0
dj50: Django>=5.0
dj51: Django>=5.1,<5.2
djdev: https://github.com/django/django/tarball/main
commands =
pip install -U pip coverage[toml]
pip install -U pip
python --version
pip --version
pip freeze
coverage run -a runtests.py
Expand All @@ -72,7 +71,19 @@ commands =
[testenv:lint]
deps = -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/lint.txt
commands =
python --version
pip --version
pip freeze
isort --profile=black --check --diff .
black --check --diff .
flake8 .
[testenv:pre-commit]
deps = pre-commit
commands =
python --version
pip --version
pip freeze
pre-commit autoupdate
pre-commit run --all-files
"""
6 changes: 2 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ keywords = django modeladmin edc clinicedc clinical trials
classifiers=
Environment :: Web Environment
Framework :: Django
Framework :: Django :: 4.2
Framework :: Django :: 5.1
Intended Audience :: Developers
Intended Audience :: Science/Research
Operating System :: OS Independent
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
License :: OSI Approved :: GNU General Public License v3 (GPLv3)


[options]
python_requires = >=3.11
python_requires = >=3.12
zip_safe = False
include_package_data = True
packages = find:
Expand Down

0 comments on commit 9b10243

Please sign in to comment.