Rated reviews application for Django
Rated reviews is derived from Django “excontrib” Comments and can be used to attach reviews with rating to any model. The core difference from comments is that user can provide only one review per item. Rating is expressed by a number and by default visualized with stars. However, it can be changed to whatever you want. Rating grades are also configurable.
Optionally rating can be weighted. For instance, you can designate experts whose rating would be more valuable. Alternatively, add weight to reviews of real byers of sold product.
Documentation is published on Read the Docs.
Requirements
- Python 3.3+
- Django 1.11+
Django Compatibility
- Django 1.11+
- Django 2.0+
- Django 3.0+
Installation
Install django-rated-reviews using pip:
pip install django-rated-reviews
Add reviews to INSTALLED_APPS. Example:
INSTALLED_APPS = (
...
'reviews',
...
)
Run manage.py migrate so that Django will create the review tables.
Add the reviews app’s URLs to your project’s urls.py:
urlpatterns = [
...
url(r'^reviews/', include('reviews.urls')),
...
]
Use the review template tags to embed reviews in your templates.
Customization
All configuration settings are optional.
REVIEW_MAX_LENGTH
The maximum length of the review comment field, in characters. Comments longer than this will be rejected. Defaults to 3000.
REVIEW_PUBLISH_UNMODERATED
If False (default) reviews are not published until they are moderated in admin. If user modifies existing review it is considered unmoderated again.
REVIEW_COMPOSE_TIMEOUT
The maximum review form timeout in seconds. The default value is 2 * 60 * 60 (2 hours).
REVIEW_RATING_CHOICES
Custom rating choices, each represented by one star (currently the maximum supported number is 10). Default choices are:
REVIEW_RATING_CHOICES = (
('1', _('Terrible')),
('2', _('Poor')),
('3', _('Average')),
('4', _('Very Good')),
('5', _('Excellent')),
)
REVIEW_SHOW_RATING_TEXT
If True (default) rating text (as specified by choices) is displayed next to rating stars.
REVIEW_ALLOW_PROFANITIES
If False review comment is checked against words in PROFANITIES_LIST. If it contains any of the words, review is rejected.
REVIEW_ADMIN_LINK_SYMBOL
Review admin exposes a link to review on a web site. By default it is shown as ▶. It can be changed to any other symbol or text,
e.g. if Font Awesome is attached to admin the following setting can be used: '<i class="fas fa-external-link-alt"></i>'.
REVIEW_APP
Custom reviews app can be set that will define custom ReviewForm, Review model or rating weight system.
Examples
Custom rating weight definition
def get_review_user_weight(user, target):
if user.has_perm('reviews.can_moderate'):
return 50
from .models import Product, Order
if isinstance(target, Product):
count = Order.objects.filter(user=user.pk,
item__product=target.pk,
status=Order.STATUS_DONE
).count()
if count > 0:
return 10
return 1
Credits
Application code is derived from Django “excontrib” Comments.
Rating widget uses star-rating.js library by Paul Ryley.
Metadata
Release files for django-rated-reviews 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-rated-reviews-1.0.1.tar.gz | 39.6 kB | Without provenance | Details for django-rated-reviews-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_rated_reviews-1.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for django_rated_reviews-1.0.1-py2.py3-none-any.whl |
Total release size: 92.4 kB
Release files / django-rated-reviews-1.0.1.tar.gz
| Download URL | django-rated-reviews-1.0.1.tar.gz |
|---|---|
| Size | 39.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
afa829b4dec6bf875b78ff3228f80fdce7182f2bf9daafd284a2c1a2be560acf
|
|
BLAKE2b-256 checksum How to use checksums |
054beb3f74a30a25c3c8070c8361a82735068e7e413173d25159493db90121dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.3
|
Release files / django_rated_reviews-1.0.1-py2.py3-none-any.whl
| Download URL | django_rated_reviews-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 52.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
3b18872f1e77185c2fa834ee042b2949c5947eba55dfe428270df5afe5b69993
|
|
BLAKE2b-256 checksum How to use checksums |
75f48a9d21bdd0dd46bc42505ca38a8d9300f7b5c5a1a6406c5ba8937ba2ffb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.3
|
Security for django-rated-reviews 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.