Application provides news functionality for your site.
-
Install package
pip install git+git://github.com/oldroute/django-easy-news.git -
Configure your settings file:
INSTALLED_APPS += ['easy_news'] -
Add urlpattern to main urls.py:
urlpatterns = [ ... url(r'^news/', include('easy_news.urls')), ...
-
Apply migrations and run local server
python manage.py migrate easy_news python manage.py runserver
Easy news has several url handlers (I mean named patterns):
news_detail- show news itselfnews_list- shows list of publicated news ifsettings.ENABLE_NEWS_LISTis Truenews_archive_index- shows content ofdjango.views.generic.date_based.archive_index_viewifnews_settings.ENABLE_NEWS_ARCHIVE_INDEXis Truenews_archive_year,news_archive_month,news_archive_day- shows news archive by given date, ifsettings.ENABLE_NEWS_DATE_ARCHIVEis Truenews_tag_detail- if you usedjango-taggingandsettings.NEWS_TAGGINGis True, easy_news provide list of tagged news
-
{% show_news <num> %}- render list ofnumlatest news.(default: 5) with templateeasy_news/parts/block.html -
{% get_news <num> %}- return queryset ofnumlatest news. (default: all) -
{% calendar <year> <month> %}- render calendar with templateeasy_news/parts/calendar.html. If there's some news at date, shows hyperlink to news (by default, use current date)
Full settings list:
-
ENABLE_NEWS_LIST(boolean) - render latest news list. Default - True -
ENABLE_NEWS_ARCHIVE_INDEX(boolean) - render django generic date archive index of news objects. Default - True -
ENABLE_NEWS_DATE_ARCHIVE(boolean) - render django generic date full archive of news objects. Default - True -
NEWS_TAGGING(boolean) - use news tagging. Default - ifdjango-tagging_ is installed, True, otherwise False -
NEWS_ADMIN_EXTRA_CLASS- Admin page customizing: dictionary of extra css classes for fields. Default -{'all': ''} -
NEWS_ADMIN_EXTRA_CSS- Admin page customizing: dictionary of extra css files for mailing list admin page. Default -{'all': ['']})Example:
NEWS_ADMIN_EXTRA_CLASS = {'all': 'my-class'} NEWS_ADMIN_EXTRA_CSS = {'all': ['css/admin/common.css']}``
0.2.3: Added haystack compatibility
Classifiers:
Frontpage handlers_
.. _django generic views system: http://docs.djangoproject.com/en/1.2/ref/generic-views/
.. _django.views.generic.date_based.archive_index: http://docs.djangoproject.com/en/1.2/ref/generic-views/#django-views-generic-date-based-archive-index
.. _django-tagging: http://pypi.python.org/pypi/django-tagging/
.. _Frontpage handlers: http://www.redsolutioncms.org/classifiers/frontpage
0.3.0: Added support for django 1.7
- Delete support menu proxy
1.11: Added support for django 1.11
- Added templatetag "get_news"
- Update template structure
- News model: new fields - "show", "creation_date", "author"; new properties - "main_content", "short_description"