0.5.6 documentation

This commit is contained in:
SDE
2024-07-11 18:37:29 +03:00
parent 37d61847ae
commit b160fb7256
3 changed files with 48 additions and 10 deletions

View File

@@ -28,6 +28,7 @@ class DocVersion(BaseModel):
class Meta:
verbose_name = _('Версия документации')
verbose_name_plural = _('Версии документации')
ordering = ['order', 'name']
class DocArt(BaseModelViewPage):
@@ -42,11 +43,33 @@ class DocArt(BaseModelViewPage):
related_name='rel_docArts_for_version'
)
def get_parents_path(self, version_obj=None):
res = []
res_ids = []
res.append(self)
res_ids.append(self.id)
obj = self
while obj.parent:
res.insert(0, obj.parent)
res_ids.insert(0, obj.parent.id)
obj = obj.parent
return res, res_ids
def __str__(self):
if self.name:
return self.name
s = self.name
else:
return str(self.id)
s = str(self.id)
if self.versions.count():
s += ' - v' + str(' - '.join(item.name for item in self.versions.filter(enable=True)))
return s
class Meta:
verbose_name = _('Статья документации')
verbose_name_plural = _('Статьи документации')
verbose_name_plural = _('Статьи документации')
# ordering = ['order', 'name']