Python crispy_forms.layout.Column() Examples
The following are 1
code examples of crispy_forms.layout.Column().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
crispy_forms.layout
, or try the search function
.
Example #1
Source File: compact.py From DCRM with GNU Affero General Public License v3.0 | 6 votes |
def helper(self): # As extra service, auto-adjust the layout based on the project settings. # This allows defining the top-row, and still get either 2 or 3 columns compact_fields = [name for name in self.fields.keys() if name in self.top_row_fields] other_fields = [name for name in self.fields.keys() if name not in self.top_row_fields] col_size = int(self.top_row_columns / len(compact_fields)) col_class = self.top_column_class.format(size=col_size) compact_row = Row(*[Column(name, css_class=col_class) for name in compact_fields]) # The fields are already ordered by the AbstractCommentForm.__init__ method. # See where the compact row should be. pos = list(self.fields.keys()).index(compact_fields[0]) new_fields = other_fields new_fields.insert(pos, compact_row) helper = CompactLabelsCommentFormHelper() helper.layout = Layout(*new_fields) helper.add_input(SubmitButton()) helper.add_input(PreviewButton()) return helper