Django-comments-dab - PyPI
Maybe your like
django-comments-dab
Thanks https://www.pythonanywhere.com/
Here is a live demo
Full Documentation
Content:
Introduction
Installation
Setup
Usage
Example
Introduction
dab stands for Django-Ajax-Bootstrap PS: Ajax and JQuery are not used anymore since v2.0.0 Vanilla JS and fetch API is used instead.
django-comments-dab is a commenting application for Django-powered websites.
It allows you to integrate commenting functionality with any model you have e.g. blogs, pictures, video etc…
List of actions that can be performed:
Post a new comment. (v2.0.0 authenticated and anonymous users)
Reply to an existing comment. (v2.0.0 authenticated and anonymous users)
Edit a comment. (authenticated user comment owner)
Delete a comment. (authenticated user comment owner and admins)
React to a comment. (authenticated users) Available reactions are LIKE and DISLIKE # open PR if you would like to have more reactions
Report (flag) a comment. (authenticated users)
Delete flagged comment. (admins and moderators)
Resolve or reject flag. This is used to revoke the flagged comment state (admins and moderators)
Follow and unfollow thread. (authenticated users)
All actions are done by Fetch API since V2.0.0
Bootstrap 4.1.1 is used in comment templates for responsive design.
Installation
Requirements:
django>=2.1
djangorestframework # only for the API Framework
Bootstrap 4.1.1
Installation:
Installation is available via pip
$ pip install django-comments-dabor via source on github
$ git clone https://github.com/abhiabhi94/Comment.git $ cd Comment $ pip install .Comment Settings and urls:
Add comment to installed_apps in the settings.py file. It should be added after django.contrib.auth.
LOGIN_URL shall be defined in the settings.
settings.py should look like this:
INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', ... 'comment', ..)LOGIN_URL = 'login' # or actual urlIn urls.py:
urlpatterns = patterns( path('admin/', admin.site.urls), path('comment/', include('comment.urls')), ... path('api/', include('comment.api.urls')), # only required for API Framework ...)Migrations:
Migrate comment app:
$ python manage.py migrate commentSetup
Step 1 - Connecting comment model with the target model
In models.py add the field comments as a GenericRelation field to the required model.
PS: Please note that the field name must be comments NOT comment.
E.g. Post model, as shown below:
fromdjango.contrib.contenttypes.fieldsimport GenericRelationfromcomment.modelsimport CommentclassPost(models.Model): author = models.ForeignKey(User) title = models.CharField(max_length=200) body = models.TextField() # the field name should be comments comments = GenericRelation(Comment)Step 2 - Adding template tags:
render_comments tag uses 2 required and 1 optional args:
Instance of the targeted model. (Required)
Request object. (Required)
oauth. (optional - Default is false)
Usage
1. Basics usage:
include_bootstrap tag is for bootstrap-4.1.1, if it’s already used in the project, get rid of this tag.
In the template (e.g. post_detail.) add the following template tags where obj is the instance of post model.
{% load comment_tags %}{# Loading the template tag #}{% render_comments obj request %}{# Render all the comments belong to the passed object "obj" #}{% include_bootstrap %}{# Include bootstrap 4.1.1 - remove this line if BS is already used in your project #}2. Advanced usage:
For advanced usage and other documentation, you may read the Documentation or look at the docs directory in the repository.
Example
You can play with the example app using local virtual environment
$gitclonehttps://github.com/abhiabhi94/Comment.git# or clone your forked repo $cdComment$python3-mvenvlocal_env# or any name. local_env is in .gitignore $exportDEBUG=True$sourcelocal_env/bin/activate$pipinstall-rtest/example/requirements.txt$pythonmanage.pymigrate$pythonmanage.pycreate_initial_data$pythonmanage.pyrunserverOr run with docker
$gitclonehttps://github.com/abhiabhi94/Comment.git# or clone your forked repo $cdComment$docker-composeupLogin with:
username: test
password: test
The icons are picked from Feather. Many thanks to them for the good work.
Email’s HTML template is used from https://github.com/leemunroe/responsive-html-email-template
Contributing
For contributing, please see the guidelines at Contributing
Tag » Add Comment Box Django
-
Django Add Comment Section On Posts Feed - Stack Overflow
-
Creating Comments System With Django
-
Django Project To Create A Comments System - GeeksforGeeks
-
Build A Blog Comment Section - Django Blog #33 - YouTube
-
Post Blog Comments - Django Blog #34 - YouTube
-
Build Complete Comment Section In Django Product Management ...
-
How To Create A Comment Section For Your Django Blog!
-
Django Blog Tutorial Part 4: Posts And Comments - Dontrepeatyourself
-
Homework: Create Comment Model - Django Girls Tutorial: Extensions
-
Implement A Comment System For A Blog Application With Django
-
Django - Comments - Tutorialspoint
-
Using Forms And Creating A Comment System In A Django Blog ...
-
Django Blog App - Add Bloging And Commenting To Your Django App
-
How To Create A Comment Section For Your Django Blog!