diff options
Diffstat (limited to 'pgweb/docs/models.py')
-rw-r--r-- | pgweb/docs/models.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pgweb/docs/models.py b/pgweb/docs/models.py index 4aafde41..5ea1497d 100644 --- a/pgweb/docs/models.py +++ b/pgweb/docs/models.py @@ -12,8 +12,17 @@ class DocPage(models.Model): title = models.CharField(max_length=256, null=True, blank=True) content = models.TextField(null=True, blank=True) + def display_version(self): + """Version as used for displaying and in URLs""" + if self.version == 0: + return 'devel' + else: + return str(self.version) + class Meta: db_table = 'docs' + # Index file first, because we want to list versions by file + unique_together = [('file', 'version')] class DocComment(PgModel, models.Model): version = models.DecimalField(max_digits=3, decimal_places=1, null=False) |