summaryrefslogtreecommitdiff
path: root/ishtar_common/models_common.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2020-12-02 17:45:58 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:22 +0100
commit3e80e0a84ede2ea2362d3602c5e7f984e8863fbb (patch)
treeee022cb560a4b0e51935fedc2edbd0769ee79012 /ishtar_common/models_common.py
parenta4e298339d8305eb2611c04543131954f8105ea9 (diff)
downloadIshtar-3e80e0a84ede2ea2362d3602c5e7f984e8863fbb.tar.bz2
Ishtar-3e80e0a84ede2ea2362d3602c5e7f984e8863fbb.zip
Docs: autogen value documentation
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r--ishtar_common/models_common.py33
1 files changed, 29 insertions, 4 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index 4f82cde8f..2374f0bf2 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -166,6 +166,14 @@ class GeneralType(Cached, models.Model):
return self.txt_idx
@classmethod
+ def get_documentation_string(cls):
+ """
+ Used for automatic documentation generation
+ """
+ return "**label** {}, **txt_idx** {}".format(str(_("Label")),
+ str(_("Textual ID")))
+
+ @classmethod
def admin_url(cls):
return str(reverse('admin:{}_{}_changelist'.format(
cls._meta.app_label, cls._meta.model_name)))
@@ -1744,9 +1752,15 @@ class Town(Imported, models.Model):
return (self.numero_insee, self.year)
def history_compress(self):
- values = {'numero_insee': self.numero_insee,
- 'year': self.year or ""}
- return values
+ return {'numero_insee': self.numero_insee, 'year': self.year or ""}
+
+ @classmethod
+ def get_documentation_string(cls):
+ """
+ Used for automatic documentation generation
+ """
+ return "**name** {}, **numero_insee** {}, **cached_label** {}".format(
+ _("Name"), "Code commune (numéro INSEE)", _("Cached name"))
def get_values(self, prefix='', **kwargs):
return {
@@ -2472,7 +2486,7 @@ class DynamicRequest:
class SpatialReferenceSystem(GeneralType):
order = models.IntegerField(_("Order"), default=10)
auth_name = models.CharField(
- _("Authority name"), default=u'EPSG', max_length=256)
+ _("Authority name"), default='EPSG', max_length=256)
srid = models.IntegerField(_("Authority SRID"))
class Meta:
@@ -2480,6 +2494,17 @@ class SpatialReferenceSystem(GeneralType):
verbose_name_plural = _("Spatial reference systems")
ordering = ('label',)
+ @classmethod
+ def get_documentation_string(cls):
+ """
+ Used for automatic documentation generation
+ """
+ doc = super(SpatialReferenceSystem, cls).get_documentation_string()
+ doc += ", **srid** {}, **auth_name** {}".format(
+ _("Authority SRID"), _("Authority name")
+ )
+ return doc
+
post_save.connect(post_save_cache, sender=SpatialReferenceSystem)
post_delete.connect(post_save_cache, sender=SpatialReferenceSystem)