django-fluent / django-fluent-comments

A modern, ajax-based appearance for django comments
https://django-fluent.org/
Apache License 2.0
182 stars 90 forks source link

enable apps to extend comment.html and form.html #87

Closed ahoho closed 7 years ago

ahoho commented 7 years ago

Now apps can extend the comment and form html used by fluent_comments.

For example, in some hypothetical Django project where we have fluent_comments installed, we can have the following setup:

/project
  /app
    /templates
      /comments
        comment.html

Then, in comment.html

{% extends 'comments/comment.html' %}
{% block fluent_comment %}
{{ block.super }}
<-- New HTML here -->
{% endblock %}
codecov-io commented 7 years ago

Current coverage is 70.31% (diff: 100%)

Merging #87 into master will not change coverage

@@             master        #87   diff @@
==========================================
  Files            11         11          
  Lines           438        438          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits            308        308          
  Misses          130        130          
  Partials          0          0          

Powered by Codecov. Last update dea98ca...a8e1f50

vdboor commented 7 years ago

Thanks for the pull request! I've merged it in a slightly different way, with more generic block names. (023a7a585aa05cb46c98dcb1287062b1d67d245a). I never thought of inheriting templates like this but it makes total sense to me.

I've also have another improvement waiting, which will add the same logic to our comments/comment.html template!

ahoho commented 7 years ago

Fantastic, thank you!