Skip to content

Instantly share code, notes, and snippets.

@guinslym
Created April 25, 2021 16:38
Show Gist options
  • Save guinslym/fefaca7cd34d44d4d0f9ea6c0a5e7423 to your computer and use it in GitHub Desktop.
Save guinslym/fefaca7cd34d44d4d0f9ea6c0a5e7423 to your computer and use it in GitHub Desktop.
from django.db import models
#https://ddialliance.org/Specification/DDI-Codebook/2.1/DTD/Documentation/DDI2-1-tree.html
#https://ddialliance.org/Specification/DDI-Codebook/2.1/DTD/Documentation/version2-1-all.html#element-definition=codeBook
#https://ddialliance.org/Specification/DDI-Codebook/2.1/
class ElementAbstractModel(models.Model):
class Meta:
abstract = True
tagName = models.CharField(
max_length=40,
)
tagNumber = models.FloatField(
)
content = models.CharField(
max_length=255,
null=True,
blank=True
)
def __str__(self) -> str:
return self.tagName
class AffiliationAbstractModel(models.Model):
class Meta:
abstract = True
affiliation = models.CharField(
max_length=100,
)
class RoleAbstractModel(models.Model):
class Meta:
abstract = True
role = models.CharField(
max_length=100,
)
class DateAbstractModel(models.Model):
class Meta:
abstract = True
date = models.DateField(
)
class AbbrAbstractModel(models.Model):
class Meta:
abstract = True
abbr = models.CharField(
max_length=100,
)
class VersionAbstractModel(models.Model):
class Meta:
abstract = True
version = models.CharField(
max_length=100,
)
class AgencyAbstractModel(models.Model):
class Meta:
abstract = True
agency = models.CharField(
max_length=100,
)
class RespstractModel(models.Model):
class Meta:
abstract = True
resp = models.CharField(
max_length=100,
)
class LevelAbstractModel(models.Model):
class Meta:
abstract = True
level = models.CharField(
max_length=100,
)
class LocationAbstractModel(models.Model):
class Meta:
abstract = True
location = models.CharField(
max_length=100,
)
class URIAbstractModel(models.Model):
class Meta:
abstract = True
uri = models.URLField(
max_length=100,
)
class EmailAbstractModel(models.Model):
class Meta:
abstract = True
email = models.EmailField(
max_length=100,
)
class VocabAbstractModel(models.Model):
class Meta:
abstract = True
vocab = models.CharField(
max_length=100,
)
vocabURI = models.URLField(
max_length=100,
)
class CallnoAbstractModel(models.Model):
class Meta:
abstract = True
callno = models.CharField(
max_length=100,
)
class MediaAbstractModel(models.Model):
class Meta:
abstract = True
media = models.CharField(
max_length=100,
)
class FormatAbstractModel(models.Model):
class Meta:
abstract = True
format_attr = models.CharField(
max_length=100,
)
class TypeAbstractModel(models.Model):
class Meta:
abstract = True
type_attr = models.CharField(
max_length=100,
)
class SdatrefsAstractModel(models.Model):
class Meta:
abstract = True
sdatrefs = models.CharField(
max_length=100,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment