Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial People app scaffold #4

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
1 change: 1 addition & 0 deletions gramps_online/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'people',
]

if os.environ.get('DJANGO_USE_DEBUG_TOOLBAR'):
Expand Down
17 changes: 17 additions & 0 deletions people/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Gramps Online - an online version of the Gramps genealogy program
#
# Copyright (C) 2018-2019 Brylie Christopher Oxley
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

20 changes: 20 additions & 0 deletions people/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Gramps Online - an online version of the Gramps genealogy program
#
# Copyright (C) 2018-2019 Brylie Christopher Oxley
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

from django.contrib import admin

# Register your models here.
22 changes: 22 additions & 0 deletions people/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Gramps Online - an online version of the Gramps genealogy program
#
# Copyright (C) 2018-2019 Brylie Christopher Oxley
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

from django.apps import AppConfig


class PeopleConfig(AppConfig):
name = 'people'
21 changes: 21 additions & 0 deletions people/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 2.1.4 on 2019-01-20 17:38

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Person',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('private', models.BooleanField(help_text='Whether this person has been designated for limited distribution or display.')),
],
),
]
18 changes: 18 additions & 0 deletions people/migrations/0002_person_sex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.1.4 on 2019-01-25 19:08

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('people', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='person',
name='sex',
field=models.CharField(choices=[('female', 'Female'), ('intersex', 'Intersex'), ('male', 'Male'), ('unknown', 'Unknown')], max_length=8, null=True),
),
]
24 changes: 24 additions & 0 deletions people/migrations/0003_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 2.1.4 on 2019-02-02 22:08

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
('people', '0002_person_sex'),
]

operations = [
migrations.CreateModel(
name='Name',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('type', models.CharField(choices=[('birth_name', 'Birth name'), ('married_name', 'Married name'),
('also_known_as', 'Also known as'),
('adoptive_name', 'Adoptive name'), ('formal_name', 'Formal name'),
('religious_name', 'Religious name')], max_length=255, null=True)),
('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='people.Person')),
],
),
]
17 changes: 17 additions & 0 deletions people/migrations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Gramps Online - an online version of the Gramps genealogy program
#
# Copyright (C) 2018-2019 Brylie Christopher Oxley
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

91 changes: 91 additions & 0 deletions people/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Gramps Online - an online version of the Gramps genealogy program
#
# Copyright (C) 2018-2019 Brylie Christopher Oxley
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

from django.db import models

class Person(models.Model):
"""
A natural person,
modeled after GEDCOM X Person
http://www.gedcomx.org/v1/Person
"""

# Choices for Person 'sex' field
brylie marked this conversation as resolved.
Show resolved Hide resolved
# using 'sex' to conform to contemporary distinction of 'sex' and 'gender' while aligning with GEDCOM X 2.0 roadmap
# see: https://github.com/FamilySearch/gedcomx/issues/318
# https://github.com/FamilySearch/gedcomx/issues/319
SEX_FEMALE = "female"
SEX_INTERSEX = "intersex"
SEX_MALE = "male"
SEX_UNKNOWN = "unknown"

SEX_CHOICES = (
(SEX_FEMALE, "Female"),
(SEX_INTERSEX, "Intersex"),
(SEX_MALE, "Male"),
(SEX_UNKNOWN, "Unknown")
)

private = models.BooleanField(
help_text="Whether this person has been designated for limited distribution or display."
)
sex = models.CharField(
max_length=8,
choices=SEX_CHOICES,
null=True,
)


class Name(models.Model):
"""
Name of a natural person.
Modeled after GEDCOM X Name
https://github.com/FamilySearch/gedcomx/blob/master/specifications/conceptual-model-specification.md#name-conclusion
"""

# GEDCOM X known name types
# https://github.com/FamilySearch/gedcomx/blob/master/specifications/conceptual-model-specification.md#known-name-types
TYPE_BIRTH_NAME = "birth_name"
TYPE_MARRIED_NAME = "married_name"
TYPE_ALSO_KNOWN_AS = "also_known_as"
TYPE_ADOPTIVE_NAME = "adoptive_name"
TYPE_FORMAL_NAME = "formal_name"
TYPE_RELIGIOUS_NAME = "religious_name"

NAME_TYPE_CHOICES = (
(TYPE_BIRTH_NAME, "Birth name"),
(TYPE_MARRIED_NAME, "Married name"),
(TYPE_ALSO_KNOWN_AS, "Also known as"),
(TYPE_ADOPTIVE_NAME, "Adoptive name"),
(TYPE_FORMAL_NAME, "Formal name"),
(TYPE_RELIGIOUS_NAME, "Religious name"),
)

person = models.ForeignKey(
Person,
null=False,
on_delete=models.CASCADE,
)
type = models.CharField(
max_length=255,
choices=NAME_TYPE_CHOICES,
null=True,
)
# TODO: determine how best to model the date field
# https://github.com/FamilySearch/gedcomx/blob/master/specifications/conceptual-model-specification.md#conclusion-date

# TODO: add NameForms model
20 changes: 20 additions & 0 deletions people/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Gramps Online - an online version of the Gramps genealogy program
#
# Copyright (C) 2018-2019 Brylie Christopher Oxley
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

from django.test import TestCase

# Create your tests here.
20 changes: 20 additions & 0 deletions people/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Gramps Online - an online version of the Gramps genealogy program
#
# Copyright (C) 2018-2019 Brylie Christopher Oxley
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

from django.shortcuts import render

# Create your views here.