diff options
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/models.py | 7 | ||||
| -rw-r--r-- | ishtar_common/models_common.py | 33 | ||||
| -rw-r--r-- | ishtar_common/version.py | 2 | 
3 files changed, 35 insertions, 7 deletions
| diff --git a/ishtar_common/models.py b/ishtar_common/models.py index a67dcc6df..38e6a7d17 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1917,8 +1917,10 @@ class Person(Address, Merge, OwnPerms, ValueGetter, MainItem):                                blank=True, null=True)      salutation = models.CharField(_("Salutation"), max_length=200,                                    blank=True, null=True) -    surname = models.CharField(_("Surname"), max_length=50, blank=True, -                               null=True) +    surname = models.CharField( +        _("Surname"), max_length=50, blank=True, null=True, +        help_text=_("Attention, historical and unfortunate residue in the " +                    "code of an initial translation error."))      name = models.CharField(_("Name"), max_length=200, blank=True,                              null=True)      raw_name = models.CharField(_("Raw name"), max_length=300, blank=True, @@ -3006,6 +3008,7 @@ class Document(BaseHistorizedItem, CompleteIdentifierItem, OwnPerms, ImageModel,      title = models.TextField(_("Title"), blank=True, default='')      associated_file = models.FileField( +        verbose_name=_("Associated file"),          upload_to=get_image_path, blank=True, null=True, max_length=255,          help_text=max_size_help())      index = models.IntegerField(verbose_name=_("Index"), blank=True, 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) diff --git a/ishtar_common/version.py b/ishtar_common/version.py index 4b6755f5b..4a0b9bcf1 100644 --- a/ishtar_common/version.py +++ b/ishtar_common/version.py @@ -3,7 +3,7 @@ VERSION = (3, 1, 0)  def get_version(): -    return u'.'.join((str(num) for num in VERSION)) +    return '.'.join((str(num) for num in VERSION))  __version__ = get_version() | 
