Skip to content
This repository has been archived by the owner on Apr 9, 2019. It is now read-only.

Allow getting groups automatically #8

Open
Martronic-SA opened this issue May 20, 2016 · 0 comments
Open

Allow getting groups automatically #8

Martronic-SA opened this issue May 20, 2016 · 0 comments

Comments

@Martronic-SA
Copy link

That would be nice to find a way to automatically add groups (group of fields) in an form (and autoform) without overriding the form.

my idea:
in fieldsets/extensible.py

class ExtensibleForm(GroupForm):
...
def getGroups(self):
adapters = getAdapters((self.context, self.request, self), IDescriptiveGroup)
groups = [group[1] for group in adapters if group[1].available]
return groups

def update(self):
    self.groups = self.groups + self.getGroups()
    self.updateFields()
    super(ExtensibleForm, self).update()

There could be also a zcml instruction like
<plone:formgroup
name="theform.mycustomgroup"
for="plone.views.IAvailableForm"
layer="IMyBrowserLayer"
class=".mygroups.Mygroup"
order="7"
/>

What do you think?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant