Skip to content

Commit

Permalink
feat(apis_entities): implement default abstract entity classes
Browse files Browse the repository at this point in the history
Closes: #403
  • Loading branch information
b1rger committed Mar 4, 2024
1 parent 5605fc0 commit b1ebd0a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
35 changes: 35 additions & 0 deletions apis_core/apis_entities/abc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from django.db import models
from apis_core.core.abc import LabelBaseModel

#########################
# Abstract base classes #
#########################


# These abstract base classes are named after
# CIDOC CRM entities, but we are *NOT*(!)
# trying to implement CIDOC CRM in Django.


class E21_Person(LabelBaseModel, models.Model):
forename = models.CharField(blank=True, default="")
surname = models.CharField(blank=True, default="")
gender = models.CharField(blank=True, default="")
date_of_birth = models.DateField(blank=True, null=True)
date_of_death = models.DateField(blank=True, null=True)

class Meta:
abstract = True


class E53_Place(LabelBaseModel, models.Model):
longitude = models.FloatField(blank=True, null=True)
latitude = models.FloatField(blank=True, null=True)

class Meta:
abstract = True


class E74_Group(LabelBaseModel, models.Model):
class Meta:
abstract = True
8 changes: 8 additions & 0 deletions apis_core/core/abc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.db import models


class LabelBaseModel(models.Model):
label = models.CharField(blank=True, default="")

class Meta:
abstract = True

0 comments on commit b1ebd0a

Please sign in to comment.