arthurk / django-disqus
- Source
- Commits
- Network (7)
- Issues (1)
- Downloads (2)
- Wiki (1)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Tue Dec 01 12:40:13 -0800 2009 | |
| |
LICENSE | Tue Jan 20 13:07:21 -0800 2009 | |
| |
README.markdown | Tue Dec 01 12:46:50 -0800 2009 | |
| |
disqus/ | Sun Dec 13 12:34:28 -0800 2009 | |
| |
setup.py | Thu Aug 20 08:24:00 -0700 2009 |
django-disqus
Easily integrate DISQUS comments into your website.
- Templatetags
- Export comments from django.contrib.comments and django-threadedcomments
- Dump DISQUS JSON data into local file
django-disqus is available open-source under the BSD license.
Installation
pip install django-disqusor clone the repo and runpython setup.py install- Add
disqusto yourINSTALLED_APPS - Add
DISQUS_API_KEYandDISQUS_WEBSITE_SHORTNAMEto your settings. You can get your API key here. The shortname of your site can be found in the right sidebar ("My Websites") on the DISQUS homepage.
Example settings.py:
INSTALLED_APPS = (
...
'django.contrib.comments',
'disqus',
)
DISQUS_API_KEY = 'FOOBARFOOBARFOOBARFOOBARFOOBARF'
DISQUS_WEBSITE_SHORTNAME = 'foobar'
Templatetags
Load the templatetags with {% load disqus_tags %}.
disqus_dev
Disables url validation and sets the page URL associated with a comment thread
to the current Site's domain if DEBUG = True.
This is neccesary to get comments working on a local development server.
{% load disqus_tags %}
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>fooar</title>
{% disqus_dev %}
</head>
disqus_show_comments
Display comments and comment form.
{% load disqus_tags %}
{% disqus_show_comments %}
Options
title: Defines the comment thread's title.url: Defines the page URL associated with a comment thread. Disqus uses this URL to uniquely create and identity a comment thread.snippet: Defines the page's content (article or blog post) to use as context.shortname: Use a different shortname thansettings.DISQUS_WEBSITE_SHORTNAME
disqus_num_replies
Replace all URLs that have the #disqus_thread anchor with their respective
comment count.
{% load disqus_tags %}
<a href="{{ object.get_absolute_url }}#disqus_thread">View Comments</a>
{% disqus_num_replies %}
disqus_recent_comments
Show recent comments.
{% load disqus_tags %}
{% disqus_recent_comments %}
Options
num_items: Number of comments to show (default: 3)avatar_size: Size of the avatars (default: 32)shortname: Use a different shortname thansettings.DISQUS_WEBSITE_SHORTNAME
disqus_top_commenters
Shows top commenters.
{% load disqus_tags %}
{% disqus_top_commenters %}
Options
num_items: Number of comments to show (default: 3)avatar_size: Size of the avatars (default: 32)shortname: Use a different shortname thansettings.DISQUS_WEBSITE_SHORTNAMEhide_mod: Set to 1 to hide moderatorshide_avatars: Set to 1 to hide avatars
disqus_popular_threads
Shows most popular threads.
{% load disqus_tags %}
{% disqus_popular_threads %}
Options
num_items: Number of comments to show (default: 3)shortname: Use a different shortname thansettings.DISQUS_WEBSITE_SHORTNAME
Management Commands
disqus-export
Exports comments from django.contrib.comments to DISQUS.
When exporting comments, make sure you have the domain of your Site set. Also
the Model to which the comments are associated needs a get_absolute_url()
method which returns the absolute url to the page the comments should
appear on.
Threaded comments are not supported.
Options
- -d/--dry-run: Does not export any comments, but merely outputs the comments which would have been exported
- -v/--verbosity: Output verbosity level; 0=minimal output, 1=normal output
disqus-threadedcomments-export
Same as disqus-export but exports comments from disqus-threadedcomments.
disqus-dumpdata
The disqus-dumpdata command dumps DISQUS comments into a local JSON file.
Options
- --indent: Specifies the indent level to use when pretty-printing output
