Skip to main content

djangocms-votes

Django cms comments, and rate system with stats

Installation

This apps suppose you have django CMS installed and well configurated.

$ pip install djangocms-votes

Add djcms_votes and django_ajax to your INSTALLED_APPS

INSTALLED_APPS = [
        ...
        'djcms_votes',
        'django_ajax',
        'ajax_select',
        'aldryn_newsblog',
]

Theoretically aldryn_newsblog is not need, but I developed thinking in it, and I do my test with this app installed

Set email per comment notifications

COMMENT_EMAIL_NOTIFICATION = ['myemail@example.com']

Configure yours urls.py

from ajax_select import urls as ajax_select_urls
urlpatterns = [
        ...
        url(r'^votes/', include('djcms_votes.urls')),
        url(r'^ajax_select/', include(ajax_select_urls)),
        ]

it’s also possible to include as url list for django>=1.10 using djcms_votes.urls.urlpatterns

if you need a login view include

from django.contrib.auth import views
from djcms_votes.forms import LoginForm
urlpatterns = [
        ...
        url(r'^accounts/login/$', views.login,
        {'template_name': 'djcms_votes/login.html',
                'authentication_form': LoginForm}, name="login"),
]

Migrations

Run migrations

$ python manage.py migrate

Include js requirements in html

Django ajax has a especial requirement that force to include js lib in your template, so you can add this to your base template

{% load staticfiles  %}

Include jquery, you need to download from cdn o from official page and include in your static folder

<script src="{% static 'js/jquery.js' %}"></script>

add before jquery those lines

<script type="text/javascript" src="{% static 'django_ajax/js/jquery.ajax.min.js' %}"></script>
<script type="text/javascript" src="{% static 'django_ajax/js/jquery.ajax-plugin.min.js' %}"></script>

Use mode

djangocms-votes provide the follow template tags, article it’s a template variable that represent page or articule, so could be whatever variable name.

{% load votes %}

  • render_comments: If user is super user them show all comments, if user is logged then show a input comment field. Super users can vote comment as possitive, negative or neutral. Email is send to COMMENT_EMAIL_NOTIFICATION when user make a comment.

    {% render_comments article %}

  • render_comment_chart: Show chart with super users comment votes for this article.

    {% render_comment_chart article %}

  • render_poll_likes: Allow user to rate article with 1-5 starts.

    {% render_poll_likes article %}

  • render_poll: Show chart with result of start rate.

    {% render_poll article %}

{% load user_votes %}

  • user_poll_likes_chart: like render_poll but for specific user.

    {% user_poll_likes_chart user %}

  • user_comment_likes_chart: like render_comment_chart but for specific user.

    {% user_comment_likes_chart user %}

Page application

A filtrable stat system is available as page application, so you can add Votes in page settings, in the application field.

Note: Votes could be translated if your are not using english.

Release files for djangocms-votes 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djangocms-votes 0.1.3
File Size Uploaded
djangocms-votes-0.1.3.tar.gz 139.2 kB Details

Release files / djangocms-votes-0.1.3.tar.gz

Download URL djangocms-votes-0.1.3.tar.gz
Size 139.2 kB
Tags Source
SHA-256 checksum
How to use checksums
768e1a0b7a2f7aeeae457b4629530fa5ae3eb938716ff1eb43a7f9340e3510f0
BLAKE2b-256 checksum
How to use checksums
f92442f281b74c7d1aa31358a9dadcafd320c9bc064b2f44b568481093254384
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.3 This release

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.4

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page