diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-05-27 15:48:31 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:20 +0100 |
commit | 0984023102759aef68cf53c0ac7b9d15c050c3c4 (patch) | |
tree | 5e7e449571279a9344cf907a48b76b1e53c1f44e /ishtar_common/models.py | |
parent | 05bb01474227af8bc7cd3c60ae384fdd469e1f60 (diff) | |
download | Ishtar-0984023102759aef68cf53c0ac7b9d15c050c3c4.tar.bz2 Ishtar-0984023102759aef68cf53c0ac7b9d15c050c3c4.zip |
Documentation - db: add new fields
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 4b9253b03..b3a19c42f 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2819,6 +2819,14 @@ def get_external_id(key, item): return value +class Language(GeneralType): + iso_code = models.CharField(_("ISO code"), null=True, blank=True, + max_length=2) + class Meta: + verbose_name = _("Language") + verbose_name_plural = _("Languages") + + CURRENCY = (("€", _("Euro")), ("$", _("US dollar"))) FIND_INDEX_SOURCE = (("O", _("Operations")), @@ -3022,6 +3030,13 @@ class IshtarSiteProfile(models.Model, Cached): help_text=_("Spatial Reference System used for display when no SRS is " "defined") ) + default_language = models.ForeignKey( + Language, + verbose_name=_("Default language for documentation"), + blank=True, null=True, + help_text=_("If set, by default the selected language will be set for " + "localized documents.") + ) objects = SlugModelManager() class Meta: @@ -3309,7 +3324,6 @@ class GlobalVar(models.Model, Cached): return str(self.slug) - def cached_globalvar_changed(sender, **kwargs): if not kwargs['instance']: return @@ -5251,9 +5265,18 @@ post_save.connect(author_post_save, sender=Author) class SourceType(HierarchicalType): + coins_type = models.CharField(_("COInS export - type"), default='document', + max_length=100) + coins_genre = models.CharField(_("COInS export - genre"), blank=True, + max_length=100) + is_localized = models.BooleanField( + _("Is localized"), default=False, + help_text=_("Setting a language for this type of document is relevant") + ) + class Meta: - verbose_name = _("Source type") - verbose_name_plural = _("Source types") + verbose_name = _("Document type") + verbose_name_plural = _("Document types") ordering = ['label'] @@ -5291,6 +5314,13 @@ class LicenseType(GeneralType): ordering = ('label',) +class DocumentTag(GeneralType): + class Meta: + verbose_name = _("Document tag") + verbose_name_plural = _("Document tags") + ordering = ('label',) + + post_save.connect(post_save_cache, sender=LicenseType) post_delete.connect(post_save_cache, sender=LicenseType) @@ -5499,8 +5529,21 @@ class Document(BaseHistorizedItem, QRCodeItem, OwnPerms, ImageModel, source_type = models.ForeignKey(SourceType, verbose_name=_("Type"), on_delete=models.SET_NULL, null=True, blank=True) + publisher = models.ForeignKey(Organization, verbose_name=_("Publisher"), + blank=True, null=True) licenses = models.ManyToManyField(LicenseType, verbose_name=_("License"), blank=True) + tags = models.ManyToManyField(DocumentTag, verbose_name=_("Tags"), + blank=True) + language = models.ForeignKey( + Language, verbose_name=_("Language"), blank=True, null=True) + issn = models.CharField(_("ISSN"), blank=True, null=True, max_length=8) + isbn = models.CharField(_("ISBN"), blank=True, null=True, max_length=13) + source = models.ForeignKey("Document", verbose_name=_("Source"), + blank=True, null=True) + source_free_input = models.CharField( + verbose_name=_("Source - free input"), blank=True, null=True, + max_length=500) support_type = models.ForeignKey(SupportType, verbose_name=_("Support"), on_delete=models.SET_NULL, blank=True, null=True, ) |