multi image upload
This commit is contained in:
@@ -29,7 +29,9 @@ class BaseBotConfigView(CabinetViewMixin, TemplateView):
|
||||
if bot_form.is_valid() and config_form.is_valid():
|
||||
return self.form_valid(bot_form, config_form)
|
||||
else:
|
||||
context = self.get_context_data(forms=(bot_form, config_form))
|
||||
context = self.get_context_data(
|
||||
forms=(bot_form, config_form)
|
||||
)
|
||||
return self.render_to_response(context)
|
||||
|
||||
def get_forms(self):
|
||||
@@ -43,9 +45,16 @@ class BaseBotConfigView(CabinetViewMixin, TemplateView):
|
||||
def get_context_data(self, forms=None, **kwargs):
|
||||
ctx = super(BaseBotConfigView, self).get_context_data(**kwargs)
|
||||
ctx['bot_form'], ctx['config_form'] = self.get_forms() if forms is None else forms
|
||||
ctx['bot_module'] = self.get_content_type().model_class()
|
||||
ctx['bot_module'] = model = self.model
|
||||
if hasattr(model, 'form_context_data'):
|
||||
bot = self.get_object()
|
||||
ctx.update(model.form_context_data(self, bot.config if bot else None))
|
||||
return ctx
|
||||
|
||||
@property
|
||||
def model(self):
|
||||
return self.get_content_type().model_class()
|
||||
|
||||
|
||||
# django-braces
|
||||
class AjaxResponseMixin(object):
|
||||
|
Reference in New Issue
Block a user