fix WebsiteAjaxTemplateMixin, added ajax 'sujets:update' form

This commit is contained in:
Arthur Gerbaud
2016-08-14 12:50:49 +02:00
parent 9e86e3eda5
commit 5dc5dae210
15 changed files with 176 additions and 116 deletions

View File

@@ -140,13 +140,15 @@ class WebsiteAjaxTemplateMixin(WebsiteTemplateMixin):
def dispatch(self, request, *args, **kwargs):
if not hasattr(self, 'content_template') or not self.content_template:
self.content_template = self.get_content_template()
if not hasattr(self, 'ajax_template'):
self.ajax_template = '%s_inner.html' % self.content_template.split(".")[0]
if request.is_ajax():
self.is_ajax = True
return super().dispatch(request, *args, **kwargs)
def get_template_names(self):
if self.is_ajax:
return [self.content_template]
return [self.ajax_template]
return super().get_template_names()
class WebsiteProtectedMixin(WebsiteTemplateMixin, PermissionRequiredMixin):