django-comment 1.0.3

Creator: danarutscher

Last updated:

Add to Cart

Description:

djangocomment 1.0.3

## Django Comment``django-comment`` is a simple Django app to add comments for your django model.This project is inspired by [django-taggit](https://github.com/alex/django-taggit) and directly derived from [django-vote](https://github.com/shanbay/django-vote)[![Build Status](https://travis-ci.org/shanbay/django-comment.svg)](https://travis-ci.org/shanbay/django-comment)[![Codecov](https://codecov.io/gh/shanbay/django-comment/coverage.svg?branch=master)](https://codecov.io/gh/shanbay/django-comment?branch=master)[![PyPI version](https://badge.fury.io/py/django-comment.svg)](https://badge.fury.io/py/django-comment)### Quick start#### Add `'comment'` to your `INSTALLED_APPS` setting like this```pythonINSTALLED_APPS = ( ... 'comment',)```#### Add `CommentModel` to the model you want to comment```pythonfrom comment.models import CommentModelclass ArticleReview(CommentModel): ...```#### Run migrate```shellmanage.py makemigrationsmanage.py migrate```#### Use comment API```pythonreview = ArticleReview.objects.get(pk=1)# Add comment for an objectreview.comments.create(user_id, content)# Removes a comment from the objectreview.comments.get(pk=comment_id).delete()# Check if the user commented the objectreview.comments.filter(user_id=user_id).exists()# Returns the number of comments for the objectreview.comments.count()# Returns all comments by userreview.comments.filter(user_id=user_id)# Use comment_objects like a native managerReview.comment_objects.filter(user_id=user_id).limit(10)# Override auto_time and auto_time_add in model fieldsfrom comment.utils import override_autotimewith override_autotime(): com = review.comments.create(user_id, content, created_at=your_timestamp)print(com.created_at) # your timestamp```

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.