Skip to content

Commit 982b7fc

Browse files
authored
Merge branch 'main' into task/CDD-2983-reject-validation-with-missing-is-public-with-override-option
2 parents 35f6a14 + 39bd875 commit 982b7fc

File tree

31 files changed

+3645
-13
lines changed

31 files changed

+3645
-13
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
repos:
2+
- repo: https://github.com/gitleaks/gitleaks
3+
rev: v8.18.1
4+
hooks:
5+
- id: gitleaks

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,49 @@ You can check for known vulnerabilities in the codebase with the following comma
244244
```bash
245245
uhd security vulnerabilities
246246
```
247+
---
248+
249+
---
250+
251+
### Pre-commit Hooks
252+
253+
This repository uses **pre-commit** to automatically scan for hardcoded secrets before allowing commits.
254+
255+
We recommend using **prek**, a faster drop-in replacement for pre-commit. It works with the existing configuration and requires no changes to the config files.
247256

248257
---
249258

259+
#### Setup (one-time)
260+
261+
1. Install `uv` (if not already installed)
262+
263+
On macOS:
264+
265+
```bash
266+
brew install uv
267+
```
268+
269+
2. Install `prek` globally:
270+
271+
```bash
272+
uv tool install prek
273+
```
274+
275+
3. Install Git Hooks(required)
276+
277+
Run this once per repository
278+
```bash
279+
prek install
280+
```
281+
This install the git hooks so secret scanning runs automatically before every commit
282+
283+
4. Run Manually(Optional)
284+
285+
To scan all files manually
286+
```bash
287+
prek run --all-files
288+
```
289+
250290
### Architectural constraints check
251291

252292
We use the `import-linter` package to enforce architectural constraints across the codebase.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"id": 83,
3+
"meta": {
4+
"seo_title": "Health topics",
5+
"search_description": "",
6+
"type": "topics_list.TopicsListPage",
7+
"detail_url": "https://http:/api/pages/83/",
8+
"html_url": "https://http://localhost:3000/health-topics/",
9+
"slug": "health-topics",
10+
"show_in_menus": false,
11+
"first_published_at": "2026-02-16T16:00:23.483810Z",
12+
"alias_of": null,
13+
"parent": {
14+
"id": 3,
15+
"meta": {
16+
"type": "home.UKHSARootPage",
17+
"detail_url": "https://http:/api/pages/3/",
18+
"html_url": null
19+
},
20+
"title": "UKHSA Dashboard Root"
21+
}
22+
},
23+
"title": "health topics",
24+
"body": "",
25+
"seo_change_frequency": 5,
26+
"seo_priority": "0.5",
27+
"last_updated_at": "2026-02-16T16:00:23.483810Z",
28+
"last_published_at": "2026-02-16T16:00:23.483810Z",
29+
"active_announcements": [],
30+
"page_description": "<p data-block-key=\"onu6j\">The UKHSA data dashboard shares public health data in a simple, inclusive and accessible way.</p>"
31+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.2.11 on 2026-02-23 12:10
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("metrics_documentation", "0012_metricsdocumentationchildentry_is_public"),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name="metricsdocumentationchildentry",
15+
name="is_public",
16+
field=models.BooleanField(default=False, verbose_name="enable public page"),
17+
),
18+
]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.2.11 on 2026-02-23 12:10
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("topic", "0025_topicpage_is_public"),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name="topicpage",
15+
name="is_public",
16+
field=models.BooleanField(default=False, verbose_name="enable public page"),
17+
),
18+
]

cms/topics_list/__init__.py

Whitespace-only changes.

cms/topics_list/apps.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.apps import AppConfig
2+
3+
4+
class TopicsListConfig(AppConfig):
5+
default_auto_field = "django.db.models.BigAutoField"
6+
name = "cms.topics_list"

cms/topics_list/managers.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"""
2+
This file contains the custom QuerySet and Manager classes associated with the `TopicsList` model.
3+
4+
Note that the application layer should only call into the `Manager` class.
5+
The application should not interact directly with the `QuerySet` class.
6+
"""
7+
8+
from django.db import models
9+
from wagtail.models import PageManager
10+
from wagtail.query import PageQuerySet
11+
12+
EXPECTED_TOPICS_LIST_PAGE_SLUG = "health-topics"
13+
14+
15+
class TopicsListPageQuerySet(PageQuerySet):
16+
"""Custom queryset for which can be used by the `TopicsListPageManager`."""
17+
18+
def get_topics_list_page(self) -> models.QuerySet:
19+
"""Gets the designated health-topics page.
20+
21+
Returns:
22+
QuerySet: A queryset of the individual topics_list page.
23+
Examples:
24+
`<TopicsListPageQuerySet [<TopicsListPage: Health Topics>, ... ]`
25+
"""
26+
return self.filter(slug=EXPECTED_TOPICS_LIST_PAGE_SLUG)
27+
28+
29+
class TopicsListPageManager(PageManager):
30+
"""Custom model manager class for the `TopicsListPageManager`."""
31+
32+
def get_queryset(self) -> TopicsListPageQuerySet:
33+
return TopicsListPageQuerySet(self.model, using=self._db)
34+
35+
def get_topics_list_page(self):
36+
"""Gets the designated health topics page.
37+
38+
Returns:
39+
The designated topics list page object
40+
which has the slug of `health-topics`
41+
"""
42+
return self.get_queryset().get_topics_list_page().last()

0 commit comments

Comments
 (0)