Skip to content
This repository was archived by the owner on Oct 2, 2024. It is now read-only.

Commit ccade11

Browse files
authored
Merge pull request #26 from nhsuk/CV-1119
Cv-1119
2 parents c475e30 + cfd5a82 commit ccade11

File tree

12 files changed

+273
-145
lines changed

12 files changed

+273
-145
lines changed

.dockerignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
**/__pycache__
2+
**/.venv
3+
**/.classpath
4+
**/.dockerignore
5+
**/.git
6+
**/.gitignore
7+
**/.project
8+
**/.settings
9+
**/.toolstarget
10+
**/.vs
11+
**/.vscode
12+
**/*.*proj.user
13+
**/*.dbmdl
14+
**/*.jfm
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/compose*
19+
**/Dockerfile*
20+
**/node_modules
21+
**/npm-debug.log
22+
**/obj
23+
**/secrets.dev.yaml
24+
**/values.dev.yaml
25+
LICENSE
26+
README.md

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ Useful Imports
2121
from django.db import models
2222
from django.db.models.signals import pre_save
2323

24-
from wagtail.admin.edit_handlers import FieldPanel, TabbedInterface, ObjectList, PageChooserPanel
25-
from wagtail.core.models import Page
24+
from wagtail.admin.panels import FieldPanel, TabbedInterface, ObjectList, PageChooserPanel
25+
from wagtail.models import Page
2626

2727
from wagtailreacttaxonomy.models import TaxonomyMixin, PageTaxonomyPermissionsMixin,\
2828
ModelTaxonomyPermissionsMixin, format_permissions_json
29-
from wagtailreacttaxonomy.edit_handlers import TaxonomyPanel, PermissionsPanel
29+
from wagtailreacttaxonomy.panels import TaxonomyPanel, PermissionsPanel
3030
```
3131

3232
How to use Taxonomy Term Component

pyproject.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[build-system]
2+
requires = [
3+
"setuptools>=61.2",
4+
]
5+
build-backend = "setuptools.build_meta"
6+
7+
[project]
8+
name = "wagtail-reacttaxonomy"
9+
version = "0.1"
10+
authors = [
11+
{ name = "Yohan Lebret", email = "yohan.lebret@gmail.com" },
12+
]
13+
description = "Add React Taxonomy component to a wagtail page and store it as a json in the db"
14+
classifiers = [
15+
"Environment :: Web Environment",
16+
"Framework :: Django",
17+
"Framework :: Django :: 4.0",
18+
"Framework :: Wagtail",
19+
"Framework :: Wagtail :: 3",
20+
"Intended Audience :: Developers",
21+
"License :: OSI Approved :: MIT License",
22+
"Operating System :: OS Independent",
23+
"Programming Language :: Python",
24+
"Programming Language :: Python :: 3.5",
25+
"Programming Language :: Python :: 3.6",
26+
"Topic :: Internet :: WWW/HTTP",
27+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
28+
]
29+
30+
[project.license]
31+
text = "MIT"
32+
33+
[project.readme]
34+
file = "README.md"
35+
content-type = "text/markdown"
36+
37+
[project.urls]
38+
Homepage = "https://github.com/nhsuk/wagtail-reacttaxonomy"
39+
40+
[tool.setuptools]
41+
include-package-data = true
42+
43+
[tool.setuptools.packages.find]
44+
namespaces = false

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Django~=4.0
2-
wagtail~=3.0
3-
psycopg2>=2.8,<2.9
2+
wagtail~=3.0.3
3+
psycopg2-binary>=<2.9.6
44
python-crontab>=2.5,<2.6
55
django-cors-headers>=3.5,<3.6
66
django-storages~=1.12

setup.py

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

test_page/management/commands/load_test_data_fixtures.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ def handle(self, *args, **options):
2323
self.no_output = options['no_output']
2424

2525
User = get_user_model()
26-
username = os.environ.get('CMS_SUPERUSER_USERNAME', 'superadmin')
26+
username = os.environ.get('CMS_SUPERUSER_USERNAME', 'admin')
2727
if not User.objects.filter(username=username).exists():
2828
# Create superuser
2929
self.stdout.write('1 - Create superuser')
30-
password = os.environ.get('CMS_SUPERUSER_PASSWORD', 'superpassword')
30+
password = os.environ.get('CMS_SUPERUSER_PASSWORD', 'admin')
3131
superuser = User.objects.create_superuser(username, None, password, id=8)
3232
self.stdout.write(self.style.SUCCESS('DONE'))
3333

@@ -38,3 +38,4 @@ def handle(self, *args, **options):
3838
except Page.DoesNotExist:
3939
pass
4040
self.stdout.write(self.style.SUCCESS('DONE'))
41+
self.stdout.write(self.style.NOTICE('run python3 ./manage.py fixtree'))
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Generated by Django 4.0.10 on 2023-08-10 21:05
2+
3+
from django.db import migrations, models
4+
import django.db.models.deletion
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('wagtailcore', '0069_log_entry_jsonfield'),
11+
('test_page', '0001_initial'),
12+
]
13+
14+
operations = [
15+
migrations.CreateModel(
16+
name='TaxTestPage',
17+
fields=[
18+
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
19+
('taxonomy_json', models.TextField(blank=True, null=True)),
20+
],
21+
options={
22+
'abstract': False,
23+
},
24+
bases=('wagtailcore.page', models.Model),
25+
),
26+
]

test_page/models.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from wagtail.models import Page
66

77
from wagtailreacttaxonomy.models import TaxonomyMixin, PageTaxonomyPermissionsMixin, ModelTaxonomyPermissionsMixin, format_permissions_json
8-
from wagtailreacttaxonomy.edit_handlers import TaxonomyPanel, PermissionsPanel
8+
from wagtailreacttaxonomy.panels import TaxonomyPanel, PermissionsPanel
99

1010

1111
class TestPage(Page, TaxonomyMixin, PageTaxonomyPermissionsMixin):
@@ -56,4 +56,15 @@ class TestModel(ModelTaxonomyPermissionsMixin):
5656
def __str__(self):
5757
return 'TestModel - {0}'.format(self.id)
5858

59-
pre_save.connect(format_permissions_json, sender=TestModel)
59+
class TaxTestPage(Page, TaxonomyMixin):
60+
61+
taxonomy_term_panels = [
62+
TaxonomyPanel('taxonomy_json', taxonomy_terms_id='test_taxonomy'),
63+
]
64+
65+
edit_handler = TabbedInterface([
66+
ObjectList(Page.content_panels, heading='Content'),
67+
ObjectList(taxonomy_term_panels, heading='Taxonomy'),
68+
])
69+
70+
pre_save.connect(format_permissions_json, sender=TestModel)

wagtailreacttaxonomy/edit_handlers.py

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

0 commit comments

Comments
 (0)