-
-
Save iign/3878d8d76a9a7c103aa2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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