Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to use django-inplaceedit to do in-place editing of a column in django-tables2 TemplateColumn?

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?

like image 689
Hec Avatar asked Jan 26 '26 03:01

Hec


1 Answers

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 %}
like image 98
Goin Avatar answered Jan 27 '26 16:01

Goin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!