Skip to content

a simple app for publishing links to news articles on your site

License

Notifications You must be signed in to change notification settings

pinax/pinax-news

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pinax News

CircleCi Codecov

Table of Contents

About Pinax

Pinax is an open-source platform built on the Django Web Framework. It is an ecosystem of reusable Django apps, themes, and starter project templates. This collection can be found at http://pinaxproject.com.

Important Links

Where you can find what you need:

pinax-news

Overview

pinax-news is a simple app for publishing links to news articles on your site.

Supported Django and Python Versions

Django / Python 3.6 3.7 3.8
2.2 * * *
3.0 * * *

Documentation

Installation

To install pinax-news:

$ pip install pinax-news

Add pinax-news to your INSTALLED_APPS setting:

INSTALLED_APPS = [
    # other apps
    "imagekit",
    "pinax.news",
]

You will need either PIL or Pillow installed for imagekit to work. We recommend Pillow:

$ pip install Pillow

Settings

There are two settings that have defaults but if you want to override them you need to just set them to the dotted-notation path to the ImageSpec class that you wish to use to process the image and secondary_image files for the image_thumb and secondary_image_thumb attributes on the News model.

PINAX_NEWS_IMAGE_THUMBNAIL_SPEC = "pinax.news.specs.ImageThumbnail"
PINAX_NEWS_SECONDARY_IMAGE_THUMBNAIL_SPEC = "pinax.news.specs.SecondaryImageThumbnail"

To create your own ImageSpec classes you can reference the defaults, but it is basically subclassing imagekit.ImageSpec.

Usage

In your template where you want to display news or press releases:

First, load the template tags:

{% load pinax_news_tags %}

For news:

{% news as news_items %}

For press releases (new stories with the press_release boolean set to True):

{% press_releases as press_release_items %}

Here is an example news item list display:

{% for news_item in news_items %}
    <article class="news-article" style="{% if news_item.secondary_image_thumb %}background-image:url({% static news_item.secondary_image_thumb.url %});{% endif %}">
        <h3>
            <a href="{{ news_item.url }}">
                {% if news_item.image_thumb %}<img src="{{ news_item.image_thumb.url }}" width="168" />{% endif %}
                <span>{{ news_item.title }}</span>
            </a>
        </h3>
    </article>
{% endfor %}

Add and manage news and press releases via the Django admin.

Change Log

3.0.0

  • Drop Django 1.11, 2.0, and 2.1, and Python 2,7, 3.4, and 3.5 support
  • Add Django 2.2 and 3.0, and Python 3.6, 3.7, and 3.8 support
  • Update packaging configs
  • Direct users to community resources

2.0.3

  • Add django>=1.11 to requirements
  • Update CI config
  • Remove doc build support
  • Add sorting guidance for 3rd-party app imports
  • Improve documentation markup

2.0.2

  • setup.py changes to support PyPi doc display

2.0.1

  • Fix setup.py LONG_DESCRIPTION for PyPi

2.0.0

  • Add Django 2.0 compatibility testing
  • Drop Django 1.8, 1.9, 1.10 and Python 3.3 support
  • Move documentation into README
  • Standardize documentation layout
  • Convert CI and coverage to CircleCi and CodeCov
  • Add PyPi-compatible long description

1.1.2

  • fix packaging

1.1.1

  • fix packaging

1.1.0

  • added support for secondary images
  • added support for customized image sizing

1.0.0

  • added docs and tests and wired up CI

0.1

  • initial release

Contribute

Contributing information can be found in the Pinax community health file repo.

Code of Conduct

In order to foster a kind, inclusive, and harassment-free community, the Pinax Project has a Code of Conduct. We ask you to treat everyone as a smart human programmer that shares an interest in Python, Django, and Pinax with you.

Connect with Pinax

For updates and news regarding the Pinax Project, please follow us on Twitter @pinaxproject and check out our Pinax Project blog.

License

Copyright (c) 2012-present James Tauber and contributors under the MIT license.

About

a simple app for publishing links to news articles on your site

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published