django-data-observer 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_data_observer-0.0.1/.github/workflows/publish.yml +51 -0
- django_data_observer-0.0.1/.gitignore +79 -0
- django_data_observer-0.0.1/.python-version +1 -0
- django_data_observer-0.0.1/LICENSE +21 -0
- django_data_observer-0.0.1/PKG-INFO +31 -0
- django_data_observer-0.0.1/README.md +15 -0
- django_data_observer-0.0.1/django_data_observer/__init__.py +0 -0
- django_data_observer-0.0.1/manage.py +16 -0
- django_data_observer-0.0.1/pyproject.toml +31 -0
- django_data_observer-0.0.1/sample_project_apis/migrations/0001_initial.py +343 -0
- django_data_observer-0.0.1/sample_project_apis/migrations/__init__.py +0 -0
- django_data_observer-0.0.1/sample_project_apis/models.py +97 -0
- django_data_observer-0.0.1/sample_project_apis/settings.py +13 -0
- django_data_observer-0.0.1/sample_project_apis/urls.py +3 -0
- django_data_observer-0.0.1/uv.lock +1519 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
build:
|
|
8
|
+
name: Build distribution
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
with:
|
|
13
|
+
persist-credentials: false
|
|
14
|
+
- name: Set up Python
|
|
15
|
+
uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.x"
|
|
18
|
+
- name: Install pypa/build
|
|
19
|
+
run: >-
|
|
20
|
+
python3 -m
|
|
21
|
+
pip install
|
|
22
|
+
build
|
|
23
|
+
--user
|
|
24
|
+
- name: Build a binary wheel and a source tarball
|
|
25
|
+
run: python3 -m build
|
|
26
|
+
- name: Store the distribution packages
|
|
27
|
+
uses: actions/upload-artifact@v4
|
|
28
|
+
with:
|
|
29
|
+
name: python-package-distributions
|
|
30
|
+
path: dist/
|
|
31
|
+
|
|
32
|
+
publish-to-pypi:
|
|
33
|
+
name: >-
|
|
34
|
+
Publish Python distribution to PyPI
|
|
35
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
36
|
+
needs:
|
|
37
|
+
- build
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
environment:
|
|
40
|
+
name: pypi
|
|
41
|
+
url: https://pypi.org/project/django-data-observer/
|
|
42
|
+
permissions:
|
|
43
|
+
id-token: write
|
|
44
|
+
steps:
|
|
45
|
+
- name: Download all the dists
|
|
46
|
+
uses: actions/download-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: python-package-distributions
|
|
49
|
+
path: dist/
|
|
50
|
+
- name: Publish distribution to PyPI
|
|
51
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
*.pyo
|
|
5
|
+
build/
|
|
6
|
+
dist/
|
|
7
|
+
wheels/
|
|
8
|
+
*.egg-info
|
|
9
|
+
*.egg
|
|
10
|
+
.eggs/
|
|
11
|
+
MANIFEST
|
|
12
|
+
|
|
13
|
+
# Virtual environments
|
|
14
|
+
.venv
|
|
15
|
+
venv/
|
|
16
|
+
env/
|
|
17
|
+
ENV/
|
|
18
|
+
.env
|
|
19
|
+
|
|
20
|
+
# Environment variables
|
|
21
|
+
.env.local
|
|
22
|
+
.env.*.local
|
|
23
|
+
|
|
24
|
+
# Distribution / packaging
|
|
25
|
+
*.tar.gz
|
|
26
|
+
*.whl
|
|
27
|
+
|
|
28
|
+
# Testing
|
|
29
|
+
.tox/
|
|
30
|
+
.nox/
|
|
31
|
+
.coverage
|
|
32
|
+
.coverage.*
|
|
33
|
+
coverage.xml
|
|
34
|
+
htmlcov/
|
|
35
|
+
.pytest_cache/
|
|
36
|
+
.hypothesis/
|
|
37
|
+
|
|
38
|
+
# Type checking
|
|
39
|
+
.mypy_cache/
|
|
40
|
+
.dmypy.json
|
|
41
|
+
.pytype/
|
|
42
|
+
.pyre/
|
|
43
|
+
|
|
44
|
+
# Linting / formatting
|
|
45
|
+
.ruff_cache/
|
|
46
|
+
|
|
47
|
+
# Django
|
|
48
|
+
*.log
|
|
49
|
+
local_settings.py
|
|
50
|
+
db.sqlite3
|
|
51
|
+
db.sqlite3-journal
|
|
52
|
+
media/
|
|
53
|
+
staticfiles/
|
|
54
|
+
static/
|
|
55
|
+
|
|
56
|
+
# Django migrations (optional — remove if you want to track migrations)
|
|
57
|
+
# */migrations/*.py
|
|
58
|
+
# !*/migrations/__init__.py
|
|
59
|
+
|
|
60
|
+
# Celery
|
|
61
|
+
celerybeat-schedule
|
|
62
|
+
celerybeat.pid
|
|
63
|
+
|
|
64
|
+
# IDE / editors
|
|
65
|
+
.idea/
|
|
66
|
+
.vscode/
|
|
67
|
+
*.swp
|
|
68
|
+
*.swo
|
|
69
|
+
*~
|
|
70
|
+
.DS_Store
|
|
71
|
+
|
|
72
|
+
# Jupyter Notebooks
|
|
73
|
+
.ipynb_checkpoints/
|
|
74
|
+
*.ipynb
|
|
75
|
+
|
|
76
|
+
# uv / pip
|
|
77
|
+
pip-log.txt
|
|
78
|
+
pip-delete-this-directory.txt
|
|
79
|
+
.uv/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Saranya Balasubramanian
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: django-data-observer
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Data observer package for Django projects
|
|
5
|
+
Project-URL: Homepage, https://github.com/gythaogg/django-data-linter
|
|
6
|
+
Author-email: Saranya Balasubramanian <saranya.balasubramanian@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: data observer
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Requires-Python: >=3.13
|
|
14
|
+
Requires-Dist: tqdm>=4.68.3
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# django-data-observer
|
|
18
|
+
|
|
19
|
+
## Aim
|
|
20
|
+
A data observer package for Django projects.
|
|
21
|
+
|
|
22
|
+
## Sample project
|
|
23
|
+
|
|
24
|
+
The APIS dependencies are only needed to run the demonstration project. Install them
|
|
25
|
+
with the `sample-project` dependency group:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
uv sync --group sample-project
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
A more generic django project to come as well, eventually.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# django-data-observer
|
|
2
|
+
|
|
3
|
+
## Aim
|
|
4
|
+
A data observer package for Django projects.
|
|
5
|
+
|
|
6
|
+
## Sample project
|
|
7
|
+
|
|
8
|
+
The APIS dependencies are only needed to run the demonstration project. Install them
|
|
9
|
+
with the `sample-project` dependency group:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
uv sync --group sample-project
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
A more generic django project to come as well, eventually.
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
def main():
|
|
6
|
+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sample_project_apis.settings')
|
|
7
|
+
try:
|
|
8
|
+
from django.core.management import execute_from_command_line
|
|
9
|
+
except ImportError as exc:
|
|
10
|
+
raise ImportError(
|
|
11
|
+
"Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?"
|
|
12
|
+
) from exc
|
|
13
|
+
execute_from_command_line(sys.argv)
|
|
14
|
+
|
|
15
|
+
if __name__ == '__main__':
|
|
16
|
+
main()
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "django-data-observer"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
description = "Data observer package for Django projects"
|
|
5
|
+
classifiers = [
|
|
6
|
+
"Programming Language :: Python :: 3",
|
|
7
|
+
"License :: OSI Approved :: MIT License",
|
|
8
|
+
"Operating System :: OS Independent",
|
|
9
|
+
]
|
|
10
|
+
keywords = ["data observer"]
|
|
11
|
+
urls = { "Homepage" = "https://github.com/gythaogg/django-data-linter" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Saranya Balasubramanian", email = "saranya.balasubramanian@gmail.com" }
|
|
14
|
+
]
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
license = "MIT"
|
|
17
|
+
requires-python = ">=3.13"
|
|
18
|
+
dependencies = [
|
|
19
|
+
"tqdm>=4.68.3",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[dependency-groups]
|
|
23
|
+
sample-project = [
|
|
24
|
+
"apis-acdhch-default-settings==2.24.1",
|
|
25
|
+
"apis-core-rdf==0.71.1",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
[build-system]
|
|
30
|
+
requires = ["hatchling"]
|
|
31
|
+
build-backend = "hatchling.build"
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
# Generated by Django 6.1.2 on 2026-10-18 23:10
|
|
2
|
+
|
|
3
|
+
import django.db.models.deletion
|
|
4
|
+
from django.db import migrations, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
|
|
9
|
+
initial = True
|
|
10
|
+
|
|
11
|
+
dependencies = [
|
|
12
|
+
("apis_metainfo", "0017_delete_uri"),
|
|
13
|
+
("relations", "0003_relation_relations_r_subj_content_type_and_more"),
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
operations = [
|
|
17
|
+
migrations.CreateModel(
|
|
18
|
+
name="Group",
|
|
19
|
+
fields=[
|
|
20
|
+
(
|
|
21
|
+
"rootobject_ptr",
|
|
22
|
+
models.OneToOneField(
|
|
23
|
+
auto_created=True,
|
|
24
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
25
|
+
parent_link=True,
|
|
26
|
+
primary_key=True,
|
|
27
|
+
serialize=False,
|
|
28
|
+
to="apis_metainfo.rootobject",
|
|
29
|
+
),
|
|
30
|
+
),
|
|
31
|
+
(
|
|
32
|
+
"label",
|
|
33
|
+
models.CharField(
|
|
34
|
+
blank=True, default="", max_length=4096, verbose_name="label"
|
|
35
|
+
),
|
|
36
|
+
),
|
|
37
|
+
],
|
|
38
|
+
options={
|
|
39
|
+
"verbose_name": "group",
|
|
40
|
+
"verbose_name_plural": "groups",
|
|
41
|
+
"ordering": ["label"],
|
|
42
|
+
"abstract": False,
|
|
43
|
+
},
|
|
44
|
+
bases=("apis_metainfo.rootobject", models.Model),
|
|
45
|
+
),
|
|
46
|
+
migrations.CreateModel(
|
|
47
|
+
name="IsCousinOf",
|
|
48
|
+
fields=[
|
|
49
|
+
(
|
|
50
|
+
"relation_ptr",
|
|
51
|
+
models.OneToOneField(
|
|
52
|
+
auto_created=True,
|
|
53
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
54
|
+
parent_link=True,
|
|
55
|
+
primary_key=True,
|
|
56
|
+
serialize=False,
|
|
57
|
+
to="relations.relation",
|
|
58
|
+
),
|
|
59
|
+
),
|
|
60
|
+
(
|
|
61
|
+
"certainty",
|
|
62
|
+
models.CharField(
|
|
63
|
+
choices=[
|
|
64
|
+
("certain", "Certain"),
|
|
65
|
+
("probable", "Probable"),
|
|
66
|
+
("uncertain", "Uncertain"),
|
|
67
|
+
],
|
|
68
|
+
default="certain",
|
|
69
|
+
max_length=10,
|
|
70
|
+
),
|
|
71
|
+
),
|
|
72
|
+
],
|
|
73
|
+
options={
|
|
74
|
+
"ordering": ["pk"],
|
|
75
|
+
"abstract": False,
|
|
76
|
+
},
|
|
77
|
+
bases=("relations.relation",),
|
|
78
|
+
),
|
|
79
|
+
migrations.CreateModel(
|
|
80
|
+
name="IsParentOf",
|
|
81
|
+
fields=[
|
|
82
|
+
(
|
|
83
|
+
"relation_ptr",
|
|
84
|
+
models.OneToOneField(
|
|
85
|
+
auto_created=True,
|
|
86
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
87
|
+
parent_link=True,
|
|
88
|
+
primary_key=True,
|
|
89
|
+
serialize=False,
|
|
90
|
+
to="relations.relation",
|
|
91
|
+
),
|
|
92
|
+
),
|
|
93
|
+
(
|
|
94
|
+
"certainty",
|
|
95
|
+
models.CharField(
|
|
96
|
+
choices=[
|
|
97
|
+
("certain", "Certain"),
|
|
98
|
+
("probable", "Probable"),
|
|
99
|
+
("uncertain", "Uncertain"),
|
|
100
|
+
],
|
|
101
|
+
default="certain",
|
|
102
|
+
max_length=10,
|
|
103
|
+
),
|
|
104
|
+
),
|
|
105
|
+
],
|
|
106
|
+
options={
|
|
107
|
+
"ordering": ["pk"],
|
|
108
|
+
"abstract": False,
|
|
109
|
+
},
|
|
110
|
+
bases=("relations.relation",),
|
|
111
|
+
),
|
|
112
|
+
migrations.CreateModel(
|
|
113
|
+
name="IsPartOf",
|
|
114
|
+
fields=[
|
|
115
|
+
(
|
|
116
|
+
"relation_ptr",
|
|
117
|
+
models.OneToOneField(
|
|
118
|
+
auto_created=True,
|
|
119
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
120
|
+
parent_link=True,
|
|
121
|
+
primary_key=True,
|
|
122
|
+
serialize=False,
|
|
123
|
+
to="relations.relation",
|
|
124
|
+
),
|
|
125
|
+
),
|
|
126
|
+
(
|
|
127
|
+
"certainty",
|
|
128
|
+
models.CharField(
|
|
129
|
+
choices=[
|
|
130
|
+
("certain", "Certain"),
|
|
131
|
+
("probable", "Probable"),
|
|
132
|
+
("uncertain", "Uncertain"),
|
|
133
|
+
],
|
|
134
|
+
default="certain",
|
|
135
|
+
max_length=10,
|
|
136
|
+
),
|
|
137
|
+
),
|
|
138
|
+
],
|
|
139
|
+
options={
|
|
140
|
+
"ordering": ["pk"],
|
|
141
|
+
"abstract": False,
|
|
142
|
+
},
|
|
143
|
+
bases=("relations.relation",),
|
|
144
|
+
),
|
|
145
|
+
migrations.CreateModel(
|
|
146
|
+
name="IsSiblingOf",
|
|
147
|
+
fields=[
|
|
148
|
+
(
|
|
149
|
+
"relation_ptr",
|
|
150
|
+
models.OneToOneField(
|
|
151
|
+
auto_created=True,
|
|
152
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
153
|
+
parent_link=True,
|
|
154
|
+
primary_key=True,
|
|
155
|
+
serialize=False,
|
|
156
|
+
to="relations.relation",
|
|
157
|
+
),
|
|
158
|
+
),
|
|
159
|
+
(
|
|
160
|
+
"certainty",
|
|
161
|
+
models.CharField(
|
|
162
|
+
choices=[
|
|
163
|
+
("certain", "Certain"),
|
|
164
|
+
("probable", "Probable"),
|
|
165
|
+
("uncertain", "Uncertain"),
|
|
166
|
+
],
|
|
167
|
+
default="certain",
|
|
168
|
+
max_length=10,
|
|
169
|
+
),
|
|
170
|
+
),
|
|
171
|
+
],
|
|
172
|
+
options={
|
|
173
|
+
"ordering": ["pk"],
|
|
174
|
+
"abstract": False,
|
|
175
|
+
},
|
|
176
|
+
bases=("relations.relation",),
|
|
177
|
+
),
|
|
178
|
+
migrations.CreateModel(
|
|
179
|
+
name="LivesIn",
|
|
180
|
+
fields=[
|
|
181
|
+
(
|
|
182
|
+
"relation_ptr",
|
|
183
|
+
models.OneToOneField(
|
|
184
|
+
auto_created=True,
|
|
185
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
186
|
+
parent_link=True,
|
|
187
|
+
primary_key=True,
|
|
188
|
+
serialize=False,
|
|
189
|
+
to="relations.relation",
|
|
190
|
+
),
|
|
191
|
+
),
|
|
192
|
+
(
|
|
193
|
+
"certainty",
|
|
194
|
+
models.CharField(
|
|
195
|
+
choices=[
|
|
196
|
+
("certain", "Certain"),
|
|
197
|
+
("probable", "Probable"),
|
|
198
|
+
("uncertain", "Uncertain"),
|
|
199
|
+
],
|
|
200
|
+
default="certain",
|
|
201
|
+
max_length=10,
|
|
202
|
+
),
|
|
203
|
+
),
|
|
204
|
+
],
|
|
205
|
+
options={
|
|
206
|
+
"ordering": ["pk"],
|
|
207
|
+
"abstract": False,
|
|
208
|
+
},
|
|
209
|
+
bases=("relations.relation",),
|
|
210
|
+
),
|
|
211
|
+
migrations.CreateModel(
|
|
212
|
+
name="Place",
|
|
213
|
+
fields=[
|
|
214
|
+
(
|
|
215
|
+
"rootobject_ptr",
|
|
216
|
+
models.OneToOneField(
|
|
217
|
+
auto_created=True,
|
|
218
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
219
|
+
parent_link=True,
|
|
220
|
+
primary_key=True,
|
|
221
|
+
serialize=False,
|
|
222
|
+
to="apis_metainfo.rootobject",
|
|
223
|
+
),
|
|
224
|
+
),
|
|
225
|
+
(
|
|
226
|
+
"label",
|
|
227
|
+
models.CharField(
|
|
228
|
+
blank=True, default="", max_length=4096, verbose_name="label"
|
|
229
|
+
),
|
|
230
|
+
),
|
|
231
|
+
(
|
|
232
|
+
"latitude",
|
|
233
|
+
models.FloatField(blank=True, null=True, verbose_name="latitude"),
|
|
234
|
+
),
|
|
235
|
+
(
|
|
236
|
+
"longitude",
|
|
237
|
+
models.FloatField(blank=True, null=True, verbose_name="longitude"),
|
|
238
|
+
),
|
|
239
|
+
(
|
|
240
|
+
"feature_code",
|
|
241
|
+
models.CharField(
|
|
242
|
+
blank=True,
|
|
243
|
+
default="",
|
|
244
|
+
help_text='<a href="https://www.geonames.org/export/codes.html" target="_blank">Geonames Feature Code List</a>',
|
|
245
|
+
max_length=16,
|
|
246
|
+
verbose_name="feature code",
|
|
247
|
+
),
|
|
248
|
+
),
|
|
249
|
+
],
|
|
250
|
+
options={
|
|
251
|
+
"verbose_name": "place",
|
|
252
|
+
"verbose_name_plural": "places",
|
|
253
|
+
"ordering": ["label"],
|
|
254
|
+
"abstract": False,
|
|
255
|
+
},
|
|
256
|
+
bases=("apis_metainfo.rootobject", models.Model),
|
|
257
|
+
),
|
|
258
|
+
migrations.CreateModel(
|
|
259
|
+
name="Profession",
|
|
260
|
+
fields=[
|
|
261
|
+
(
|
|
262
|
+
"id",
|
|
263
|
+
models.BigAutoField(
|
|
264
|
+
auto_created=True,
|
|
265
|
+
primary_key=True,
|
|
266
|
+
serialize=False,
|
|
267
|
+
verbose_name="ID",
|
|
268
|
+
),
|
|
269
|
+
),
|
|
270
|
+
("name", models.CharField(blank=True, default="", max_length=1024)),
|
|
271
|
+
],
|
|
272
|
+
options={
|
|
273
|
+
"abstract": False,
|
|
274
|
+
},
|
|
275
|
+
),
|
|
276
|
+
migrations.CreateModel(
|
|
277
|
+
name="Person",
|
|
278
|
+
fields=[
|
|
279
|
+
(
|
|
280
|
+
"rootobject_ptr",
|
|
281
|
+
models.OneToOneField(
|
|
282
|
+
auto_created=True,
|
|
283
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
284
|
+
parent_link=True,
|
|
285
|
+
primary_key=True,
|
|
286
|
+
serialize=False,
|
|
287
|
+
to="apis_metainfo.rootobject",
|
|
288
|
+
),
|
|
289
|
+
),
|
|
290
|
+
(
|
|
291
|
+
"forename",
|
|
292
|
+
models.CharField(
|
|
293
|
+
blank=True, default="", max_length=4096, verbose_name="forename"
|
|
294
|
+
),
|
|
295
|
+
),
|
|
296
|
+
(
|
|
297
|
+
"surname",
|
|
298
|
+
models.CharField(
|
|
299
|
+
blank=True, default="", max_length=4096, verbose_name="surname"
|
|
300
|
+
),
|
|
301
|
+
),
|
|
302
|
+
(
|
|
303
|
+
"date_of_birth",
|
|
304
|
+
models.DateField(
|
|
305
|
+
blank=True, null=True, verbose_name="date of birth"
|
|
306
|
+
),
|
|
307
|
+
),
|
|
308
|
+
(
|
|
309
|
+
"date_of_death",
|
|
310
|
+
models.DateField(
|
|
311
|
+
blank=True, null=True, verbose_name="date of death"
|
|
312
|
+
),
|
|
313
|
+
),
|
|
314
|
+
("bio", models.TextField(blank=True)),
|
|
315
|
+
(
|
|
316
|
+
"gender",
|
|
317
|
+
models.CharField(
|
|
318
|
+
choices=[
|
|
319
|
+
("male", "Male"),
|
|
320
|
+
("female", "Female"),
|
|
321
|
+
("other", "Other"),
|
|
322
|
+
("unknown", "Unknown"),
|
|
323
|
+
],
|
|
324
|
+
default="unknown",
|
|
325
|
+
max_length=20,
|
|
326
|
+
),
|
|
327
|
+
),
|
|
328
|
+
(
|
|
329
|
+
"profession",
|
|
330
|
+
models.ManyToManyField(
|
|
331
|
+
blank=True, to="sample_project_apis.profession"
|
|
332
|
+
),
|
|
333
|
+
),
|
|
334
|
+
],
|
|
335
|
+
options={
|
|
336
|
+
"verbose_name": "person",
|
|
337
|
+
"verbose_name_plural": "persons",
|
|
338
|
+
"ordering": ["surname", "forename"],
|
|
339
|
+
"abstract": False,
|
|
340
|
+
},
|
|
341
|
+
bases=("apis_metainfo.rootobject", models.Model),
|
|
342
|
+
),
|
|
343
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
from django.db import models
|
|
2
|
+
|
|
3
|
+
from apis_core.entities.abc import E21_Person, E53_Place, E74_Group
|
|
4
|
+
from apis_core.apis_entities.models import AbstractEntity
|
|
5
|
+
from apis_core.generic.abc import GenericModel
|
|
6
|
+
from apis_core.relations.models import Relation
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Profession(GenericModel, models.Model):
|
|
10
|
+
name = models.CharField(blank=True, default="", max_length=1024)
|
|
11
|
+
|
|
12
|
+
def __str__(self):
|
|
13
|
+
return self.name
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class Person(E21_Person, AbstractEntity):
|
|
17
|
+
profession = models.ManyToManyField(Profession, blank=True)
|
|
18
|
+
bio = models.TextField(blank=True)
|
|
19
|
+
gender = models.CharField(
|
|
20
|
+
max_length=20,
|
|
21
|
+
choices=[
|
|
22
|
+
("male", "Male"),
|
|
23
|
+
("female", "Female"),
|
|
24
|
+
("other", "Other"),
|
|
25
|
+
("unknown", "Unknown"),
|
|
26
|
+
],
|
|
27
|
+
default="unknown",
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Place(E53_Place, AbstractEntity):
|
|
32
|
+
pass
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Group(E74_Group, AbstractEntity):
|
|
36
|
+
pass
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class RelationMixin(Relation):
|
|
40
|
+
certainty = models.CharField(
|
|
41
|
+
max_length=10,
|
|
42
|
+
choices=[
|
|
43
|
+
("certain", "Certain"),
|
|
44
|
+
("probable", "Probable"),
|
|
45
|
+
("uncertain", "Uncertain"),
|
|
46
|
+
],
|
|
47
|
+
default="certain",
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
class Meta:
|
|
51
|
+
abstract = True
|
|
52
|
+
ordering = ["pk"]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class IsCousinOf(RelationMixin):
|
|
56
|
+
subj_model = Person
|
|
57
|
+
obj_model = Person
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def reverse_name(self) -> str:
|
|
61
|
+
return "is cousin of"
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class IsPartOf(RelationMixin):
|
|
65
|
+
subj_model = Person
|
|
66
|
+
obj_model = Group
|
|
67
|
+
|
|
68
|
+
@classmethod
|
|
69
|
+
def reverse_name(self) -> str:
|
|
70
|
+
return "consists of"
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class IsSiblingOf(RelationMixin):
|
|
74
|
+
subj_model = Person
|
|
75
|
+
obj_model = Person
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def reverse_name(self) -> str:
|
|
79
|
+
return "is sibling of"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class LivesIn(RelationMixin):
|
|
83
|
+
subj_model = Person
|
|
84
|
+
obj_model = Place
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def reverse_name(self) -> str:
|
|
88
|
+
return "has inhabitant"
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class IsParentOf(RelationMixin):
|
|
92
|
+
subj_model = Person
|
|
93
|
+
obj_model = Person
|
|
94
|
+
|
|
95
|
+
@classmethod
|
|
96
|
+
def reverse_name(self) -> str:
|
|
97
|
+
return "is child of"
|