Git Product home page Git Product logo

djangocms-comments's Introduction

Latest Travis CI build status

Latest PyPI version

Python versions

Code Climate

Test coverage

Requirements Status

DjangoCMS Comments

A comment system for Django CMS unintrusive and easy to use. Add it to your pages without modifying your models. It is highly customizable!

These are the principles of Django CMS Comments:

  • It does not require javascript to work (but it is recommended).
  • Almost everything is customizable.
  • Anonymous users can post comments.
  • It is easy to use and install.
  • Comments really are in your website.

Example: http://nekmo.com/es/blog/demo-page/

Installation

You can install DjangoCMS-Comments From Pypi:

pip install djangocms-comments

...Or you can install directly from source:

git clone https://github.com/Nekmo/djangocms-comments.git
cd djangocms-comments
python setup.py install

You can also install it from Aldryn cloud:

https://marketplace.django-cms.org/en/addons/browse/djangocms-comments/

Optional depends

  • user-agents==1.0.1: Improved description of user agent in the comments.
  • pykismet3==0.1.1: Akismet support.
  • aldryn-boilerplates>=0.7.4: Bootstrap3 theme.

All optional depends:

pip install user-agents==1.0.1 pykismet3==0.1.1 aldryn-boilerplates>=0.7.4

Configuration

First you need to add djangocms_comments to your INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    'djangocms_comments',
]

Now run migrations:

python manage.py migrate

Add to your urlpatterns:

urlpatterns = [
    url(r'^djangocms_comments/', include('djangocms_comments.urls')),
]

That's all!

Optional: Akismet support

  1. Install python-akismet: pip install python-akismet>=0.2.1.
  2. Create an account and get a API KEY: https://akismet.com/ (You don't need to pay)
  3. Add to your settings:
SPAM_PROTECTION = {
    'default': {
        'BACKEND': 'djangocms_comments.spam.Akismet',
        'TOKEN': '1ba29d6f120c',
    },
}

Optional: Bootstrap3 theme usign Aldryn Boilerplates

  1. Install aldryn-boilerplates: pip install aldryn-boilerplates>=0.7.4.
  2. Configure Aldryn Boilerplates: https://github.com/aldryn/aldryn-boilerplates

Usage

DjangoCMS-Comments includes a plugin. Add the plugin to a page, preferably in a "static placeholder".

The first time you add a plugin, you need to create a new configuration. You can create different configurations for separate different comments lists on the same page.

For example, you have a blog with two languages. The posts are translated (the id is the same) and you need separate comments. The solution is to create a plugin for each language with a different configuration.

Comments will be associated to the instance in the page. That instance is necessary.

To make the relationship, DjangoCMS-Comments uses a GenericForeignKey. If the primary key is not an integer, the relationship will not work! However, this is not usual.

Settings

You can overwrite the following options in your settings file:

https://github.com/Nekmo/djangocms-comments/blob/master/djangocms_comments/settings.py

Features

  • Anonymous and registers users comments.
  • Pretty comment administration.
  • Akismet support.
  • Moderation options: spam, hidden, soft deleted, edited...
  • Easy to add to any page.
  • Many customization options.
  • Separates comments systems by language and sites.
  • Pretty Bootstrap3 integration.

TODO

  • Social authentication (Twitter, Google, Facebook, Github...).
  • Reply comments.
  • Rich text.
  • Options for authentication methods (disable anonymous...).
  • Send notifications to admins (new comment, moderation required...).
  • Sending messages to users (new answers, reply to my comment...).

Contribute

Please feel free to send a pull request. All suggestions are welcome.

djangocms-comments's People

Contributors

chromakey avatar darex1991 avatar marksweb avatar nekmo avatar zippolag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

djangocms-comments's Issues

Error saving comment in anonymous mode

Internal Server Error: /djangocms_comments/ajax/save_comment
Traceback (most recent call last):
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 883, in _resolve_lookup
    current = current[bit]
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/context.py", line 77, in __getitem__
    raise KeyError(key)
KeyError: 'comments_settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 889, in _resolve_lookup
    if isinstance(current, BaseContext) and getattr(type(current), bit):
AttributeError: type object 'RequestContext' has no attribute 'comments_settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 898, in _resolve_lookup
    current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'comments_settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/core/handlers/base.py", line 174, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/core/handlers/base.py", line 172, in get_response
    response = response.render()
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/response.py", line 160, in render
    self.content = self.rendered_content
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/response.py", line 137, in rendered_content
    content = template.render(context, self._request)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/backends/django.py", line 95, in render
    return self.template.render(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 206, in render
    return self._render(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 197, in _render
    return self.nodelist.render(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 992, in render
    bit = node.render_annotated(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 959, in render_annotated
    return self.render(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/defaulttags.py", line 326, in render
    return nodelist.render(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 992, in render
    bit = node.render_annotated(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 959, in render_annotated
    return self.render(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 1043, in render
    output = self.filter_expression.resolve(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 730, in resolve
    arg_vals.append(arg.resolve(context))
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 850, in resolve
    value = self._resolve_lookup(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 905, in _resolve_lookup
    (bit, current))  # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [comments_settings] in "[{'None': None, 'False': False, 'True': True}, {}, {}, {'is_user': False, 'comment': <Comment: [Demo page] In diam odio, varius sed orci eu, dic...>, 'form': <UnregisteredCommentForm bound=False, valid=Unknown, fields=(username;email;website;body;page_type;page_id;config_id)>}]"
Internal Server Error: /djangocms_comments/ajax/save_comment
Traceback (most recent call last):
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 883, in _resolve_lookup
    current = current[bit]
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/context.py", line 77, in __getitem__
    raise KeyError(key)
KeyError: 'comments_settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 889, in _resolve_lookup
    if isinstance(current, BaseContext) and getattr(type(current), bit):
AttributeError: type object 'RequestContext' has no attribute 'comments_settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 898, in _resolve_lookup
    current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'comments_settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/core/handlers/base.py", line 174, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/core/handlers/base.py", line 172, in get_response
    response = response.render()
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/response.py", line 160, in render
    self.content = self.rendered_content
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/response.py", line 137, in rendered_content
    content = template.render(context, self._request)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/backends/django.py", line 95, in render
    return self.template.render(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 206, in render
    return self._render(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 197, in _render
    return self.nodelist.render(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 992, in render
    bit = node.render_annotated(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 959, in render_annotated
    return self.render(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/defaulttags.py", line 326, in render
    return nodelist.render(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 992, in render
    bit = node.render_annotated(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 959, in render_annotated
    return self.render(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 1043, in render
    output = self.filter_expression.resolve(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 730, in resolve
    arg_vals.append(arg.resolve(context))
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 850, in resolve
    value = self._resolve_lookup(context)
  File "/home/nekmocom/.virtualenvs/nekmo.com/lib/python3.5/site-packages/django/template/base.py", line 905, in _resolve_lookup
    (bit, current))  # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [comments_settings] in "[{'None': None, 'False': False, 'True': True}, {}, {}, {'is_user': False, 'comment': None, 'form': <UnregisteredCommentForm bound=True, valid=False, fields=(username;email;website;body;page_type;page_id;config_id)>}]"

New PyPi Release

Any chance you can do a new PyPi release with the latest pull request integrated for email notifications?

Thanks so much.

v0.2.x roadmap

TODO

  • More unittests.
  • User documentation.
  • Example screens.

v0.3.0 roadmap

TODO

  • Disable anonymous/authenticated users.
  • Refactor Comments model to Abstract model.
  • Moderate comments in front.
  • reCaptcha support.

keyerror

keyerror at -es-quienes-somos- - google chrome_011

my configurations:

INSTALLED_APPS = (
    ...,
    'djangocms_comments',
)

COMMENT_PUBLISHED_BY_DEFAULT = True
SPAM_PROTECTION = {} 
MIN_LENGTH_COMMENT_BODY = 50
MAX_LENGTH_COMMENT_BODY = 12000
MAX_BREAKLINES_COMMENT_BODY = 12
MAX_UPPERCASE_RATIO_COMMENT_BODY = 0.3
COMMENT_TEXTAREA_ROWS = 4
COMMENT_WAIT_SECONDS = 120
COMMENT_PREVENT_USURP_USERNAME = True


for var_name, value in dict(locals()).items():
    if var_name.isupper():
        locals()[var_name] = getattr(settings, var_name, value)

help me, please

Is this plugin still supported?

This is the only comments plugin I'm seeing for Django CMS. But I can't even install it. It looks like I might need to downgrade pip to install according to a stackoverflow article??

I'm getting:

File "/private/var/folders/r7/8n5l_mfd1qq74sq2f2nnxzx80000gn/T/pip-install-DKYgvU/djangocms-comments/setup.py", line 4, in from pip.req import parse_requirements
ImportError: No module named req
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/r7/8n5l_mfd1qq74sq2f2nnxzx80000gn/T/pip-install-DKYgvU/djangocms-comments/

ImportError: cannot import name CheckboxChoiceInput

python 2.7, Django 1.11.16, v0.2.3, when run # python manage.py migrate after updating the settings, it showes:

# python manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/root/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/root/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute
    django.setup()
  File "/root/env/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/root/env/lib/python2.7/site-packages/django/apps/registry.py", line 116, in populate
    app_config.ready()
  File "/root/env/lib/python2.7/site-packages/django/contrib/admin/apps.py", line 23, in ready
    self.module.autodiscover()
  File "/root/env/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 26, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/root/env/lib/python2.7/site-packages/django/utils/module_loading.py", line 50, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/root/env/lib/python2.7/site-packages/djangocms_comments-0.2.3-py2.7.egg/djangocms_comments/admin.py", line 14, in <module>
    from djangocms_comments.fields import SubmitButtonField, MultipleSubmitButtonRendered, MultipleSubmitButton, \
  File "/root/env/lib/python2.7/site-packages/djangocms_comments-0.2.3-py2.7.egg/djangocms_comments/fields.py", line 5, in <module>
    from django.forms.widgets import CheckboxChoiceInput, ChoiceFieldRenderer, RadioChoiceInput, SubWidget, RendererMixin, \

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.