Explorar o código

[doc2] Add has_children property

Johan Ahlen %!s(int64=9) %!d(string=hai) anos
pai
achega
65720b5
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      desktop/core/src/desktop/models.py

+ 4 - 0
desktop/core/src/desktop/models.py

@@ -937,6 +937,10 @@ class Document2(models.Model):
   def is_home_directory(self):
     return self.is_directory and self.parent_directory == None and self.name == ''
 
+  @property
+  def has_children(self):
+    return self.children.filter(is_history=False).exists()
+
   @property
   def is_trash_directory(self):
     return self.is_directory and self.name == self.TRASH_DIR