diff --git a/combo/data/models.py b/combo/data/models.py index 6cd4608a..b1bfc40a 100644 --- a/combo/data/models.py +++ b/combo/data/models.py @@ -217,6 +217,7 @@ class CellBase(models.Model): default_form_class = None visible = True user_dependant = False + manager_form_template = 'combo/cell_form.html' class Meta: abstract = True @@ -316,6 +317,9 @@ class CellBase(models.Model): return model_forms.modelform_factory(self.__class__, fields=['public', 'groups']) + def get_extra_manager_context(self): + return {} + def is_visible(self, user=None): return element_is_visible(self, user=user) diff --git a/combo/manager/templates/combo/cell_form.html b/combo/manager/templates/combo/cell_form.html index 3152d3e9..fcc115e8 100644 --- a/combo/manager/templates/combo/cell_form.html +++ b/combo/manager/templates/combo/cell_form.html @@ -1,4 +1,5 @@ {% load i18n %} +{% block cell-form %}
{% csrf_token %} {% if form %} @@ -6,7 +7,9 @@ {% else %}

{% trans "There are no options for this cell." %}

{% endif %} +{% endblock %}
+{% block cell-buttons %} {% trans 'Delete' %} | {% trans 'Visibility' %} | {% trans 'Options' %} | @@ -14,5 +17,6 @@ {% if form %} {% endif %} +{% endblock %}
diff --git a/combo/manager/templatetags/cells.py b/combo/manager/templatetags/cells.py index e2ded652..390706d4 100644 --- a/combo/manager/templatetags/cells.py +++ b/combo/manager/templatetags/cells.py @@ -28,5 +28,7 @@ def cell_form(context, cell): context['form'] = form_class(instance=cell, prefix='c%s' % cell.get_reference()) else: context['form'] = None - cell_form_template = template.loader.get_template('combo/cell_form.html') - return cell_form_template.render(context) + cell_form_template = template.loader.get_template(cell.manager_form_template) + with context.push(): + context.update(cell.get_extra_manager_context()) + return cell_form_template.render(context)