Browse Source

EmType : .fieldgroups() filter using EmFieldGroups

ArnAud 9 years ago
parent
commit
55afedc863
1 changed files with 2 additions and 15 deletions
  1. 2
    15
      EditorialModel/types.py

+ 2
- 15
EditorialModel/types.py View File

@@ -84,26 +84,13 @@ class EmType(EmComponent):
84 84
     ## Get the list of non empty associated fieldgroups
85 85
     # @return A list of EmFieldGroup instance
86 86
     def fieldgroups(self):
87
-        fieldgroups = []
88
-        for fieldgroup in self.em_class.fieldgroups():
89
-            for field in fieldgroup.fields():
90
-                if not field.optional or field.uid in self._fields['fields']:
91
-                    fieldgroups.append(fieldgroup)
92
-                    break
87
+        fieldgroups = [fieldgroup for fieldgroup in self.em_class.fieldgroups() if len(fieldgroup.fields(self.uid))]
93 88
         return fieldgroups
94 89
 
95
-    ## Get the list of all Emfield possibly associated with this type
96
-    # @return A list of EmField instance
97
-    def all_fields(self):
98
-        res = []
99
-        for fieldgroup in self.fieldgroups():
100
-            res += fieldgroup.fields()
101
-        return res
102
-
103 90
     ## Return selected optional field
104 91
     # @return A list of EmField instance
105 92
     def selected_fields(self):
106
-        selected = [ self.model.component(field_id) for field_id in self._fields['fields'] ]
93
+        selected = [self.model.component(field_id) for field_id in self._fields['fields']]
107 94
         return selected
108 95
 
109 96
     ## Return the list of associated fields

Loading…
Cancel
Save