3

I tried to make a state_template.html with

{% load inplace_edit %}
{% block extra_header %}
    {% inplace_static %}
{% endblock %}
{% inplace_edit "action.action_state" %}

And tables.py has:

action_state = tables.TemplateColumn(template_name='django_tables2/state_template.html', verbose_name="State")

But since action is never being passed to the template, it is giving an error. Does anyone have any ideas on how to make this work?

Hec
  • 824
  • 1
  • 5
  • 24

1 Answers1

2

This is a very nice question :-)

I think if you update your template (state_template.html), with this should works:

{% load inplace_edit %}

{% block extra_header %}
    {% inplace_static %}
{% endblock %}

{% inplace_edit "record.action_state" %}

And this is a recomendation, You should move to the template of the view that renderthe table, but this is only to efficiency:

{% block extra_header %}
    {% inplace_static %}
{% endblock %}
Goin
  • 3,856
  • 26
  • 44