Welcome to django-djeddit’s documentation!¶
Contents:
django-djeddit¶
Bare bones Django forum application with Reddit like features developed as a Django reusable app.
- comments are ranked using wilson scoring interval and displayed in a collapsable tree structure (using django-mptt)
- voting functionality for threads & comments
- compatible with mobile screen sizes (using Bootstrap)
- users management page for admins
- admins can lock/unlock, edit, delete threads and posts, edit & delete topics
django-registration-redux is recommanded to go along with this app if you need out of the box user registration functionality.
Working demo: http://eatemall.pythonanywhere.com
Documentation: https://django-djeddit.readthedocs.io.
Supported Dajngo versions¶
The app is currently tested with Django 1.8, 1.9, 1.10 and 1.11, 2.0
Quickstart¶
Install django-djeddit:
pip install django-djeddit
Add it and its dependencies to your INSTALLED_APPS:
INSTALLED_APPS = [
...
'crispy_forms',
'mptt',
'djeddit',
'meta',
...
]
djeddit_settings to context_processors:
'context_processors': [
...
'djeddit.context_processors.djeddit_settings',
...
]
jango-djeddit’s URL patterns:
urlpatterns = [
...
url(r'^', include('djeddit.urls')),
...
]
Migrate models:
python manage.py migrate djeddit
Create a topic:
You can use New Topic dialog in topics page if you’re logged in as a superuser or you can create one in a python console:
from djeddit.models import Topic
Topic.objects.create(title='Test Topic')
Installation¶
At the command line:
$ easy_install django-djeddit
Or, if you have virtualenvwrapper installed:
$ mkvirtualenv django-djeddit
$ pip install django-djeddit
Configuration¶
To use django-djeddit in a project, add it to your INSTALLED_APPS:
INSTALLED_APPS = [
...
'crispy_forms',
'mptt',
'djeddit',
'meta',
...
]
And djeddit_settings to context_processors:
'context_processors': [
...
'djeddit.context_processors.djeddit_settings',
...
]
Add django-djeddit’s URL patterns:
urlpatterns = [
...
url(r'^', include('djeddit.urls')),
...
]
Migrate models:
python manage.py migrate djeddit
Additional Options¶
By default the base template is djeddit/base.html
You can change the default base template in settings.py:
DJEDDIT_BASE_TEMPLATE = "path/to/template.html"
In order for the base template to work properly with the app’s templtes it needs to contain the following:
within <head>…</head>:
{% load staticfiles %}
{% include 'djeddit/base_stylesheets.html' %}
within <body>…</body>:
{% block title %}{% endblock %}
{% block content %}{% endblock %}
{% block scripts %}{% endblock %}
{% include 'djeddit/base_scripts.html' %}
{% block scripts %}{% endblock %}
You can use the structue of djeddit/base.html for reference.
SiteMap¶
If you’d like djeddit to generate sitemaps for SEO you can follow these steps. Djeddit comes with a sitemaps.py file included and you just have to enable it.
Add the following apps to your installed apps if they are not already there
'django.contrib.sites',
'django.contrib.sitemaps',
Create the sitemaps dictionary with the djeddit sitemap and core django sitemap imports in the urls.py of your project
Now add the following to your urlpatterns
url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
Run migrations and run server
If you visit sitemap.xml on your site you should have a working sitemap for djeddit threads.
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/EatEmAll/django-djeddit/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “feature” is open to whoever wants to implement it.
Write Documentation¶
django-djeddit could always use more documentation, whether as part of the official django-djeddit docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/EatEmAll/django-djeddit/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up django-djeddit for local development.
Fork the django-djeddit repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/django-djeddit.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv django-djeddit $ cd django-djeddit/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:
$ flake8 djeddit tests $ python setup.py test $ tox
To get flake8 and tox, just pip install them into your virtualenv.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- The pull request should work for Python 2.6, 2.7, and 3.3, and for PyPy. Check https://travis-ci.org/EatEmAll/django-djeddit/pull_requests and make sure that the tests pass for all supported Python versions.
Credits¶
Development Lead¶
- Roman <megaclaff@gmail.com>
History¶
0.1.0 (2017-04-15)¶
- First release on PyPI.
0.1.5 (2017-05-26)¶
- Added tests for models, forms, views
- Urls that include topic titles with spaces in them don’t work // fixed
- Competability fixes for Django 1.9 and 1.8 and Python 2.7
- client side fixes for added compatibility with mobile screen sizes
- font-awsome fonts are not loading // fixed
- Added description field for Topic model
- moved base.html to root template dir
0.2 (2017-07-04)¶
- Admins can lock/unlock & delete threads, delete posts
- Admins can edit thread title, url, and post content
- added users management page for admins
- admins can edit & delete topics
- added fields upvotes, downvotes, wsi (Wilson score interval) to Post model
- removed score field from Post model
- comments are ranked using wilson scoring interval
- added comments paging functionality (using “Load n more comments” links)
0.3 (2018-06-02)¶
- added option to define url prefix in settings.TOPICS_URL for topic & thread pages
- added sitemap support
- added url slugs to threads
- added ip & user agent tracking for posts
- added compatibility to Django 2.0
- added thread stickies (can be added or removed by admins)