Skip to content

Instantly share code, notes, and snippets.

@iign
Created January 19, 2015 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iign/3878d8d76a9a7c103aa2 to your computer and use it in GitHub Desktop.
Save iign/3878d8d76a9a7c103aa2 to your computer and use it in GitHub Desktop.
class DynamicLayoutHandler(object):
def _check_layout(self):
if self.layout is None:
raise FormHelpersException("You need to set a layout in your FormHelper")
def _check_layout_and_form(self):
self._check_layout()
if self.form is None:
raise FormHelpersException("You need to pass a form instance to your FormHelper")
def all(self):
"""
Returns all layout objects of first level of depth
"""
self._check_layout()
return LayoutSlice(self.layout, slice(0, len(self.layout.fields), 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment