Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
3e20297
chore(refactor): Eliminate cove_ocds.lib package. first_render is not…
jpmckinney Oct 19, 2024
93b3440
build: Upgrade libcoveocds
jpmckinney Oct 19, 2024
59e1d60
feat: Remove OCDS Show
jpmckinney Oct 19, 2024
eb21e2e
feat: Remove release and record tables
jpmckinney Oct 19, 2024
48bc988
feat: Remove Key Field Information
jpmckinney Oct 19, 2024
8c3a343
chore(content): Remove "More Information" and "User Tracking" blocks
jpmckinney Oct 19, 2024
054da03
feat: Remove conversion to CSV and Excel
jpmckinney Oct 19, 2024
e058861
Merge branch 'main' into no-ocds-show
jpmckinney Oct 19, 2024
a3369bf
feat: Remove version switching. Always check against the latest versi…
jpmckinney Oct 19, 2024
fc09c99
chore: Add bootstrap files directly
jpmckinney Oct 20, 2024
f54a46f
chore: Add font files directly
jpmckinney Oct 20, 2024
90e5bde
feat: Merge the used parts of lib-cove-web with some refactoring
jpmckinney Oct 20, 2024
af76d4b
fix: Make source_url required (regression from making it blank but no…
jpmckinney Oct 20, 2024
da62f32
fix: Don't show publisher name if name not present
jpmckinney Oct 20, 2024
9ad2e16
feat: Remove unneeded model fields and methods
jpmckinney Oct 20, 2024
b7638f5
test: Remove footer tests
jpmckinney Oct 20, 2024
87566e0
fix: Don't delete the same files repetitively and forever
jpmckinney Oct 20, 2024
d915fb4
build: Add werkzeug
jpmckinney Oct 20, 2024
8b2423b
docs: Add Security comments (SSRF)
jpmckinney Oct 20, 2024
8c8da15
build: Add requests. Add migration.
jpmckinney Oct 21, 2024
41a1f4f
build: Upgrade ocdsextensionregistry
jpmckinney Oct 21, 2024
f884750
fix: Fix conditions for tabular files. Remove unnecessary filters, al…
jpmckinney Oct 21, 2024
845bbe8
i18n: Run python manage.py makemessages -a
jpmckinney Oct 21, 2024
39e0abd
i18n: Fix translated strings that are partial sentences, and fix subs…
jpmckinney Oct 21, 2024
46ced91
i18n: Remove deleted translations
jpmckinney Oct 21, 2024
264a2d4
chore: Fix blocktrans syntax from previous commits
jpmckinney Oct 21, 2024
693a573
i18n: Fix translated strings that are broken sentences
jpmckinney Oct 21, 2024
d350416
chore: Skip sorting keys
jpmckinney Oct 26, 2024
6cbfacd
chore: Make modal sample size easier to configure
jpmckinney Oct 26, 2024
f05d9d3
chore: common_error_types is always empty for OCDS
jpmckinney Oct 26, 2024
19364e2
chore: Remove curly quotes
jpmckinney Oct 26, 2024
be217ba
chore: Fix Docker lettercase warning
jpmckinney Nov 8, 2024
1e586b8
ci: Reuse workflow for automerge
jpmckinney Nov 25, 2024
c7d459e
ci: Reuse workflow for i18n
jpmckinney Nov 26, 2024
4b8bcd7
ci: Reuse workflow for docker
jpmckinney Nov 26, 2024
cbfca5c
ci: Reuse workflow for lint
jpmckinney Nov 26, 2024
6910617
Build
jpmckinney Nov 26, 2024
ae2dfb0
ci(lint): Add PAT
jpmckinney Nov 27, 2024
0b7dc68
Merge branch 'main' into no-ocds-show
jpmckinney Dec 9, 2024
7ae3c0f
test: Use spaces instead of tabs in fixtures
jpmckinney Dec 17, 2024
75b3e76
chore: Update settings to handbook template
jpmckinney Jan 8, 2025
1760f89
feat: Add sort filter, as values are no longer guaranteed to be sorte…
jpmckinney Jan 8, 2025
f79d9b7
ci: Pin coveralls action
jpmckinney Mar 21, 2025
850534d
Merge branch 'main' into no-ocds-show-merge
jpmckinney Aug 2, 2025
64dd2b3
test: Remove trailing whitespace from fixtures
jpmckinney Aug 2, 2025
4eeeab2
ci: Add permissions to workflows
jpmckinney Aug 2, 2025
6a71d0e
Merge branch 'main' into no-ocds-show
jpmckinney Aug 2, 2025
796d1a9
build: Upgrade ocdsextensionregistry
jpmckinney Aug 2, 2025
d897661
chore: Use new ruff-check hook id
jpmckinney Aug 12, 2025
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
37 changes: 5 additions & 32 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,8 @@
# The pull_request_target workflow trigger is dangerous. Do not add unrelated logic to this workflow.
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
name: Auto-merge
on: pull_request_target
permissions:
pull-requests: write # to approve the PR
contents: write # to merge the PR
jobs:
dependabot:
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- id: dependabot-metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' || steps.dependabot-metadata.outputs.package-ecosystem == 'github_actions' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr review --approve ${{ github.event.pull_request.html_url }}
- if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' || steps.dependabot-metadata.outputs.package-ecosystem == 'github_actions' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr merge --auto --squash ${{ github.event.pull_request.html_url }}
precommit:
if: ${{ github.event.pull_request.user.login == 'pre-commit-ci[bot]' }}
runs-on: ubuntu-latest
steps:
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr review --approve ${{ github.event.pull_request.html_url }}
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr merge --auto --squash ${{ github.event.pull_request.html_url }}
automerge:
uses: open-contracting/.github/.github/workflows/automerge.yml@main
permissions:
pull-requests: write
contents: write
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
- run: ./manage.py --help
- run: pip install -r requirements_dev.txt
- run: playwright install chromium
# Compile messages, so that lib-cove-web translations are available.
- name: Install gettext
run: |
sudo apt update
Expand All @@ -29,11 +28,11 @@ jobs:
env:
PYTHONWARNINGS: error
shell: bash
# https://github.com/OpenDataServices/flatten-tool/pull/458
# https://github.com/OpenDataServices/flatten-tool/pull/458 > 0.20.0
# https://github.com/OpenDataServices/flatten-tool/issues/412
run: |
./manage.py migrate
./manage.py makemigrations --check --dry-run
./manage.py check --fail-level WARNING
coverage run --source=core,cove_ocds -m pytest -W error -W ignore::DeprecationWarning:ijson.compat -W ignore::ResourceWarning
- uses: coverallsapp/github-action@v2
- uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
32 changes: 3 additions & 29 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,6 @@ on:
- completed
jobs:
docker:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# https://github.com/docker/login-action#github-container-registry
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# https://github.com/docker/setup-buildx-action#usage
- uses: docker/setup-buildx-action@v3
# https://github.com/docker/build-push-action#usage
- uses: docker/build-push-action@v6
with:
push: true
file: Dockerfile_django
tags: |
ghcr.io/${{ github.repository }}-django:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: docker/build-push-action@v6
with:
push: true
file: Dockerfile_static
tags: |
ghcr.io/${{ github.repository }}-static:latest
cache-from: type=gha
cache-to: type=gha,mode=max
uses: open-contracting/.github/.github/workflows/docker-django.yml@main
permissions:
packages: write
25 changes: 4 additions & 21 deletions .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,7 @@ on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
cache-dependency-path: '**/requirements*.txt'
- name: Install translate-toolkit
run: |
sudo apt update
sudo apt install gettext translate-toolkit
- run: pip install -r requirements.txt
- run: python manage.py makemessages -a
- name: Count incomplete translations
shell: bash
run: |
output=$(find . -name LC_MESSAGES -not -path "*/en/*" -exec pocount --incomplete --short "{}" +)
echo $output
[ "$output" = "" ]
i18n:
uses: open-contracting/.github/.github/workflows/i18n-django.yml@main
permissions:
contents: read
3 changes: 0 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ jobs:
contents: write
secrets:
personal-access-token: ${{ secrets.PAT }}
with:
# https://github.com/OpenDataServices/lib-cove-web/pull/153
standard-maintenance-scripts-ignore: cove
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.2
hooks:
- id: ruff
- id: ruff-check
- id: ruff-format
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.7.19
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

The DRT is a web application that allows you to review Open Contracting data, validate it against the Open Contracting Data Standard, and review it for errors or places for improvement. You can also use it to convert data between JSON and Excel spreadsheet formats.
The DRT is a web application that allows you to review Open Contracting data, validate it against the Open Contracting Data Standard, and review it for errors or places for improvement.

Docs about running locally etc. at https://ocds-data-review-tool.readthedocs.io/en/latest/
5 changes: 2 additions & 3 deletions core/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
def from_settings(_request):
return {
"fathom": settings.FATHOM,
"hotjar": settings.HOTJAR,
"releases_or_records_table_length": settings.RELEASES_OR_RECORDS_TABLE_LENGTH,
"releases_or_records_table_slice": f":{settings.RELEASES_OR_RECORDS_TABLE_LENGTH}",
"support_email": settings.SUPPORT_EMAIL,
"delete_files_after_days": settings.DELETE_FILES_AFTER_DAYS,
}
38 changes: 13 additions & 25 deletions core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
SECRET_KEY = os.getenv("SECRET_KEY", "7ur)dt+e%1^e6$8_sd-@1h67_5zixe2&39%r2$$8_7v6fr_7ee")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = not production
DEBUG = os.getenv("DEBUG", str(not production)) == "True"

ALLOWED_HOSTS = [".localhost", "127.0.0.1", "[::1]", "0.0.0.0"] # noqa: S104 # Docker
if "ALLOWED_HOSTS" in os.environ:
Expand All @@ -49,8 +49,6 @@
"django.contrib.messages",
"django.contrib.staticfiles",
"bootstrap3",
"cove",
"cove.input",
"cove_ocds",
]

Expand All @@ -64,7 +62,7 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"cove.middleware.CoveConfigCurrentApp",
"cove_ocds.middleware.ExceptionMiddleware",
)

ROOT_URLCONF = "core.urls"
Expand All @@ -81,7 +79,6 @@
"django.template.context_processors.i18n",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"cove.context_processors.from_settings",
"core.context_processors.from_settings",
],
},
Expand Down Expand Up @@ -186,6 +183,11 @@
"handlers": ["null"],
"propagate": False,
},
"django.db.backends": {
"handlers": ["console"],
"level": "DEBUG" if production else os.getenv("LOG_LEVEL", "INFO"),
"propagate": False,
},
},
}

Expand Down Expand Up @@ -232,14 +234,6 @@
)

COVE_CONFIG = {
# lib-cove-web options
"app_name": "cove_ocds",
"app_base_template": "cove_ocds/base.html",
"app_verbose_name": "Open Contracting Data Review Tool",
"app_strapline": "Review your OCDS data.",
"input_methods": ["upload", "url", "text"],
"input_template": "cove_ocds/input.html",
"support_email": "data@open-contracting.org",
# SchemaOCDS options (add {lang} to the path)
"schema_version_choices": {
# version: (display, url, tag),
Expand All @@ -250,22 +244,16 @@
# Set default schema version to the latest version.
COVE_CONFIG["schema_version"] = list(COVE_CONFIG["schema_version_choices"])[-1]

DELETE_FILES_AFTER_DAYS = int(os.getenv("DELETE_FILES_AFTER_DAYS", "90")) # default 7
REQUESTS_TIMEOUT = int(os.getenv("REQUESTS_TIMEOUT", "10")) # default None
VALIDATION_ERROR_LOCATIONS_LENGTH = int(os.getenv("VALIDATION_ERROR_LOCATIONS_LENGTH", "100")) # default 1000


# Project configuration

FATHOM = {
"domain": os.getenv("FATHOM_ANALYTICS_DOMAIN") or "cdn.usefathom.com",
"id": os.getenv("FATHOM_ANALYTICS_ID"),
}

HOTJAR = {
"id": os.getenv("HOTJAR_ID", ""),
"sv": os.getenv("HOTJAR_SV", ""),
"date_info": os.getenv("HOTJAR_DATE_INFO", ""),
}

RELEASES_OR_RECORDS_TABLE_LENGTH = int(os.getenv("RELEASES_OR_RECORDS_TABLE_LENGTH", "25"))
DELETE_FILES_AFTER_DAYS = int(os.getenv("DELETE_FILES_AFTER_DAYS", "90"))
REQUESTS_TIMEOUT = int(os.getenv("REQUESTS_TIMEOUT", "10"))
SUPPORT_EMAIL = "data@open-contracting.org"
USER_AGENT = os.getenv(
"USER_AGENT", "DataReviewTool/1.0 (+https://review.standard.open-contracting.org; data@open-contracting.org)"
)
7 changes: 0 additions & 7 deletions core/templates/terms.html

This file was deleted.

14 changes: 7 additions & 7 deletions core/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from cove.urls import (
handler500, # noqa: F401
urlpatterns,
)
from django.conf import settings
from django.conf.urls.static import static
from django.urls import re_path
from django.urls import include, re_path

import cove_ocds.views

urlpatterns += [re_path(r"^data/(.+)$", cove_ocds.views.explore_ocds, name="explore")]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns = [
re_path(r"^$", cove_ocds.views.data_input, name="index"),
re_path(r"^data/(.+)$", cove_ocds.views.explore_ocds, name="explore"),
re_path(r"^i18n/", include("django.conf.urls.i18n")),
*static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT),
]
14 changes: 14 additions & 0 deletions cove_ocds/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from http import HTTPStatus


class DataReviewToolError(Exception):
"""Base class for exceptions from within this module."""


class InputError(DataReviewToolError):
"""Raised if the input data is irretriavable or unprocessabe."""

def __init__(self, message="", heading="", status=HTTPStatus.OK):
self.message = message
self.heading = heading
self.status = status
23 changes: 23 additions & 0 deletions cove_ocds/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from django import forms
from django.utils.translation import gettext_lazy as _

from cove_ocds import models


class UploadForm(forms.ModelForm):
class Meta:
model = models.SuppliedData
fields = ["original_file"]
labels = {"original_file": _("Upload a file (.json, .xlsx, .ods, .csv)")}


class UrlForm(forms.ModelForm):
source_url = forms.URLField(required=True, label=_("Supply a URL"))

class Meta:
model = models.SuppliedData
fields = ["source_url"]


class TextForm(forms.Form):
paste = forms.CharField(label=_("Paste (JSON only)"), widget=forms.Textarea)
Loading
Loading