diff options
author | Rogelio Mita <rogeliomita@activitycentral.com> | 2013-06-27 21:28:57 (GMT) |
---|---|---|
committer | Rogelio Mita <rogeliomita@activitycentral.com> | 2013-06-27 21:28:57 (GMT) |
commit | a6cd46dd2c6e3a1dfef5e6bb14acbd6a1f351a67 (patch) | |
tree | 8d81b401203a5872d7420f422d499d75b8c0080f | |
parent | 1035f4671f8a98372021f972b7fd46ef64c5e178 (diff) |
BugFix: dependenciesv4.6
-rw-r--r-- | webapp/polls/models.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/webapp/polls/models.py b/webapp/polls/models.py index ba8f9a5..4d06bdf 100644 --- a/webapp/polls/models.py +++ b/webapp/polls/models.py @@ -676,23 +676,28 @@ class Field(AbstractObject, ComponentStructure): self.widget_type = widget_type def get_field_offset(self, structure): - inc_count = 0 - stop = False + + field_counts = {} + + for group in structure.groups: + field_counts.update({"%s" % group.order: len(group.fields)}) + + group_order = 0 for group in structure.groups: for field in group.fields: if field.name == self.name: - stop = True + group_order = group.order break - else: - inc_count += 1 if stop: break - offset = inc_count + offset = 0 + for index in range(0, group_order): + offset += int(field_counts[str(index)]) - return offset + return offset + self.order def show_dependence(self): form = self.dependence.get('form', 4) |