danirus / django-comments-xtd

A pluggable Django comments application with thread support, follow-up notifications, mail confirmation, like/dislike flags, moderation, a ReactJS plugin and Bootstrap 5.3.
https://django-comments-xtd.readthedocs.io
BSD 2-Clause "Simplified" License
595 stars 158 forks source link

Custom templates are not loaded when using Javascript Plugin #376

Open hejazizo opened 1 year ago

hejazizo commented 1 year ago

Hey,

Without javascript plugin everything looks fine and I'm able to have my custom templates.

When I load it though and add the line <div id="comments"></div>, the templates are gone and it loads it with the default templates which I can't find even in the django-comments-xtd library installation directory.

Has anyone had this experience? Does javascript plugin only comes with no template support and only loads its own default template?

Screen Shot 2022-08-03 at 11 32 24 AM

I also have tried this:

<div id="comments">
{% render_xtdcomment_tree for object allow_flagging allow_feedback show_feedback %}
</div>

Still no template loading.

hejazizo commented 1 year ago

When I load

<script
    type="text/javascript"
    src="{% url 'javascript-catalog' %}">
</script>

templates are gone.

danirus commented 1 year ago

Hi @hejazizo, Yes, that's the expected behaviour with this particular JavaScript plugin, because it's written using ReactJS and it takes "advantage" of the JSX syntax, but it comes at the expense of not using the Django templates. I like how easy it is to write code the ReactJS framework, but I would also like if the JavaScript plugin used the Django templates.

I have been working for quite some time already in the version 3.0.0 of django-comments-xtd, and recently I created a new django app based on it. I created a new app because there are enough differences to make such a fork. The new app is django-comments-ink, and its JavaScript plugin uses Django templates. The plugin is written in vanilla JavaScript.

There is a Django project that shows how it works, the dci-project-stories. I am still adding features and writing the docs. But the README.md of that project might be enough to start.