# Django-channels consumer.py to display a table.py from django-table2 in a template in Django

**URL:** <https://forum.djangoproject.com/t/django-channels-consumer-py-to-display-a-table-py-from-django-table2-in-a-template-in-django/18823>\
**Category:** Forms & APIs\
**Created:** [February 13, 2023, 10:15pm UTC](https://forum.djangoproject.com/t/django-channels-consumer-py-to-display-a-table-py-from-django-table2-in-a-template-in-django/18823 "2023-02-13T22:15:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [February 13, 2023, 11:04pm UTC](https://forum.djangoproject.com/t/django-channels-consumer-py-to-display-a-table-py-from-django-table2-in-a-template-in-django/18823/2 "2023-02-13T23:04:38Z")

</div>

Fundamentally, there’s not a whole lot of difference between the two.

If you think about what the chat example is _doing_ on the client side, it’s receiving some text being sent to it, and updating the current page. In this case, it’s adding the text to a div.

If you’re rendering a complete table, and you send the html for that table through the connection, then the client will add _that_ text to a div.

So there’s no functional difference in the client for the basic case.

Now, when you want to have different things being updated, you need to have your JS examine the data being returned to determine what should be done, but that’s not a significant conceptual difference.

On the server side, again - there’s no conceptual difference here. In the chat example, the consumer receives text, and turns around and sends that text back out. In your tables example, the consumer would receive whatever message it needs to receive, render the html for the table, and send _that_ back out to the client.

So the infrastructure doesn’t change. You’re adding functionality to the chat app, not replacing it.

Side note: I _strongly_ encourage you to take a look at HTMX for handling websockets. It was a game-changer for me. There are _so_ many things it makes _so_ much easier.

---

_[View the full topic](https://forum.djangoproject.com/t/django-channels-consumer-py-to-display-a-table-py-from-django-table2-in-a-template-in-django/18823)._
