A reusable Django app for managing news/blog entries in different languages.
Project description
A reusable Django app for managing news/blog entries in different languages.
Comes with a django-cms apphook and has been prepared using Django 1.5.1 and django-cms 2.4.1. From version 2.0 onwards it is tested and developed further on Django 1.9 and django-cms 3.
This app is based on the great https://github.com/fivethreeo/cmsplugin-blog and re-used some of it’s snippets.
Current features include
Entry authors based on a django-people Person
Entry attachments based on the django-document-library Document
Tagging via django-multilingual-tags with a tag based archive view
Entry categories
RSS Feeds for all news entries, just special authors or tag based.
Site maps
SEO fields on the Entry for storing custom individual meta descriptions and titles.
Installation
If you want to install the latest stable release from PyPi:
$ pip install django-multilingual-news
If you feel adventurous and want to install the latest commit from GitHub:
$ pip install -e git://github.com/bitmazk/django-multilingual-news.git#egg=multilingual_news
Add multilingual_news to your INSTALLED_APPS:
INSTALLED_APPS = ( ..., 'django_libs', 'multilingual_news', 'people', 'hvad', 'multilingual_tags', 'document_library', # cms related requirements (please check the relevant `documentation <https://github.com/divio/django-cms>`) 'cms', 'menus', 'treebeard', # filer related requirements (please check the relevant `documentation <https://github.com/divio/django-filer>`) 'filer', 'easy_thumbnails', )
Run the migrations:
./manage.py migrate
Usage
Placeholders (“excerpt” and “content”)
To add content to a news entry, you can make use of two cms placeholders. The excerpt is used in list views only. Adding content to a placeholder works pretty much the same like adding content to a cms page. First, create a news entry, then go to its detail view. Use the django cms toolbar to add plugins to the placeholders. For more information visit Django CMS’ documentation.
Using the apphook
Simply create a django-cms page and select Multilingual News Apphook in the Application field of the Advanced Settings.
Sitemaps
To add a sitemap of your blog, add the following to your urlconf:
from multilingual_news.sitemaps import NewsSitemap urlpatterns += patterns( '', url(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', { 'sitemaps': { 'blogentries': NewsSitemap, }, }), )
RSS Feeds
The app provides three different types of feeds, you can link to.
All news {% url "news_rss" %}
News from a specific author {% url "news_rss_author" author=author.pk %}, where author is an instance of a people.Person
All news {% url "news_rss_tagged" tag=tag.slug %}, where Tag is an instance of a multilingual_tags.Tag.
Tagging
You can simply add tags for a news entry from the NewsEntry admin page, which renders an inline form at the bottom.
Twitter Bootstrap 3
List of Bootstrap compatible features:
A delete confirmation modal for deleting news entries.
For support of the Twitter Bootstrap 3 functionality, you need to add the Bootstrap js library to your template. If you haven’t already
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
Delete confirmation modal
Add the following markup to your template.
{% load static %}
{# add this before bootstrap.js #}
<script type="text/javascript" src="{% static "django_libs/js/modals.js" %}"></script>
<div id="ajax-modal" class="modal fade" tabindex="-1">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
</div>
</div>
</div>
To trigger the modal, create a link that looks like this.
<a href="{% url "news_delete" pk=news_entry.pk %}" data-class="toggleDeleteModal">Delete</a>
Settings
NEWS_PAGINATION_AMOUNT
Default: 10
Amount of news entries to display in the list view.
Contribute
If you want to contribute to this project, please perform the following steps
# Fork this repository
# Clone your fork
mkvirtualenv -p python2.7 django-multilingual-news
make develop
git co -b feature_branch master
# Implement your feature and tests
git add . && git commit
git push -u origin feature_branch
# Send us a pull request for your feature branch
In order to run the tests, simply execute tox. This will install two new environments (for Django 1.8 and Django 1.9) and run the tests against both environments.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-multilingual-news-2.6.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a25ff22874dfe51cf98fd0c2868006e7e58cb41432d54dbee86de65b8c2b0ce4 |
|
MD5 | f0fe109ce61e21272fa7e6ecc2321d94 |
|
BLAKE2b-256 | 8a441202f0ebbbbf088e69fc505b9a1a3612464ca6424a14d9fb8928e4581371 |