Skip to content

Commit

Permalink
Support modal sizes by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkuty committed Mar 23, 2016
1 parent bbad8a8 commit 1d63044
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions horizon_contrib/forms/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,17 @@ def get_context_data(self, **kwargs):

# add extra context for template
context['url'] = self.request.build_absolute_uri()
context['modal_size'] = self._get_moda_size()

return context

def _get_moda_size(self):
'''try get form_size attribute form form or widget'''
form_class = self.get_form_class()
return getattr(form_class,
'form_size',
getattr(self.model, 'form_size', 'md'))


class ModelModalView(ModalFormView):

Expand Down

0 comments on commit 1d63044

Please sign in to comment.