Skip to content

Commit

Permalink
Merge 3478aed into 7ece66a
Browse files Browse the repository at this point in the history
  • Loading branch information
wolendranh committed Oct 30, 2018
2 parents 7ece66a + 3478aed commit 9da6c0b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions arctic/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class FormMixin(ModalMixin):
links = None
readonly_fields = None
ALLOWED_COLUMNS = 12 # There are 12 columns available
form = None # store form instance to eliminate multiple form initialization

def get_cancel_url(self):
if self.request.GET.get("inmodal"):
Expand Down Expand Up @@ -492,12 +493,13 @@ def _update_form_fields(
return form

def get_form(self, form_class=None):
form = super(FormMixin, self).get_form(form_class=None)
try:
form = self.update_form_fields(form)
except AttributeError:
pass
return form
if not self.form:
self.form = super(FormMixin, self).get_form(form_class=None)
try:
self.form = self.update_form_fields(self.form)
except AttributeError:
pass
return self.form

def get_context_data(self, **kwargs):
context = super(FormMixin, self).get_context_data(**kwargs)
Expand Down

0 comments on commit 9da6c0b

Please sign in to comment.