Browse Source

[EmFieldGroup] implementation of the EmField objects deletion on a EmFieldGroup deletion process

Roland Haroutiounian 9 years ago
parent
commit
2fc6084c82
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      EditorialModel/fieldgroups.py

+ 10
- 0
EditorialModel/fieldgroups.py View File

@@ -45,6 +45,16 @@ class EmFieldGroup(EmComponent):
45 45
 
46 46
         return super(EmFieldGroup, cls).create(**em_component_args)
47 47
 
48
+    ## Deletes a fieldgroup
49
+    def delete(self):
50
+        # all the EmField objects contained in this fieldgroup should be deleted first
51
+        fieldgroup_fields = self.fields()
52
+        for fieldgroup_field in fieldgroup_fields:
53
+            fieldgroup_field.delete()
54
+
55
+        # then we delete this fieldgroup
56
+        # TODO Process de suppression du fieldgroup dans le modèle éditorial
57
+
48 58
     ## Get the list of associated fields
49 59
     # @return A list of EmField instance
50 60
     def fields(self):

Loading…
Cancel
Save