Browse Source

EmType delete() method partial implementation

Actually not able to check relation_to_type deletion constraints
Yann Weber 9 years ago
parent
commit
0ab7f5aafb
1 changed files with 13 additions and 1 deletions
  1. 13
    1
      EditorialModel/types.py

+ 13
- 1
EditorialModel/types.py View File

45
 
45
 
46
         return exists
46
         return exists
47
     
47
     
48
+    ## @brief Delete an EmType
49
+    # The deletion is only possible if a type is not linked by any EmClass
50
+    # and if it has no subordinates
51
+    # @return True if delete False if not deleted
52
+    # @todo Check if the type is not linked by any EmClass
53
+    # @todo Check if there is no other ''non-deletion'' conditions
54
+    def delete(self):
55
+        if len(self.subordinates()) > 0:
56
+            return False
57
+        return super(EmType, self).delete()
58
+        
59
+
48
     ## Get the list of associated fieldgroups
60
     ## Get the list of associated fieldgroups
49
     # @return A list of EmFieldGroup instance
61
     # @return A list of EmFieldGroup instance
50
     def field_groups(self):
62
     def field_groups(self):
241
         for row in rows:
253
         for row in rows:
242
             result.append(EmType(row['subordinate_id'] if row['superior_id']==self.uid else row['superior_id']))
254
             result.append(EmType(row['subordinate_id'] if row['superior_id']==self.uid else row['superior_id']))
243
 
255
 
244
-        return result
256
+        return result

Loading…
Cancel
Save