• Stars
    star
    187
  • Rank 200,083 (Top 5 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created almost 4 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A news curator and newsletter subscription package for Django

django-newsfeed

What is django-newsfeed?

django-newsfeed is a news curator and newsletter subscription package for django. It can be used to create a news curator website which sends newsletters to their subscribers also it can be used to add a news subscription section to your website.

Features

  • Create monthly, weekly or daily issues with draft issue support.
  • Create posts with different categories.
  • Archive and display all of the issues in your website.
  • Newsletter e-mail subscription (ajax support) with e-mail verification.
  • Newsletter e-mail unsubscription (ajax support).
  • Sending newsletters for each issue to all the subscribers.
  • Fully customizable templates.
  • Uses Django's internal tools for sending email.
  • Efficient mass mailing support.

Requirements

  • Python: 3.6, 3.7, 3.8, 3.9, 3.10
  • Django: 2.2, 3.0, 3.1, 3.2, 4.0

Example Project

You can view the example project for this package here. This is a news-curator and newsletter subscription application that only uses this package. It also uses celery, celery-beat and redis to send email newsletters in the background. The styles in the example project uses bootstrap.

Documentation

Installation

Install django-newsfeed using pip:

pip install django-newsfeed

Then add newsfeed to your INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'newsfeed',
]

Then add newsfeed to your projects urls.py:

urlpatterns = [
    ...
    path('newsfeed/', include('newsfeed.urls', namespace='newsfeed')),
    ...
]

Usage

Available views

We provide these views out of the box:

  • latest_issue: newsfeed/
  • issue_list: newsfeed/issues/
  • issue_detail: newsfeed/issues/<slug:issue_number>/
  • newsletter_subscribe: newsfeed/subscribe/
  • newsletter_subscription_confirm: newsfeed/subscribe/confirm/<uuid:token>/
  • newsletter_unsubscribe: newsfeed/unsubscribe/

Templates

The basic templates are provided for all the views and emails with django-newsfeed. You can override the templates to add your own design.

Just add newsfeed directory inside your templates directory add templates with the same name as the showed tree below. more on template overriding on the django docs

Template Tree for django-newfeed:

templates
    └── newsfeed
        ├── base.html
        ├── email
        │     ├── email_verification.html
        │     ├── email_verification_subject.txt
        │     ├── email_verification.txt
        │     └── newsletter_email.html
        ├── issue_detail.html
        ├── issue_list.html
        ├── issue_posts.html
        ├── latest_issue.html
        ├── messages.html
        ├── newsletter_subscribe.html
        ├── newsletter_subscription_confirm.html
        ├── newsletter_unsubscribe.html
        └── subscription_form.html

Subscription confirmation Email

We send subscription confirmation email to the new subscribers. you can override these template to change the styles:

templates
    └── newsfeed
        ├── email
        │     ├── email_verification.html
        │     ├── email_verification_subject.txt
        │     ├── email_verification.txt

Admin Actions

These actions are available from the admin panel:

  • publish issues: The selected issues will be published.
  • mark issues as draft: The selected issues will be marked as draft.
  • hide posts: The selected posts will be hidden from the issues.
  • make posts visible: The selected posts will visible on the issues.
  • send newsletters: Sends selected newsletters to all the subscribers.

(send newsletters action should be overridden to use a background task queue. See the example project to see an example using celery)

Send Email Newsletter

We provide a class to handle sending email newsletters to the subscribers. We do not provide any background task queue by default. But it is fairly easy to set it up.

See the example project to see an example using celery and celery-beat.

You can override this template to change the style of the newsletter:

templates
    └── newsfeed
        ├── email
        │     └── newsletter_email.html

Settings Configuration

The below settings are available for django-newsfeed. Add these settings to your projects settings.py as required.

NEWSFEED_SITE_BASE_URL

  • default: http://127.0.0.1:8000 (your sites URL)
  • required: True

This settings is required. You need to add your websites URL here in production. This is used to generate confirmation URL and unsubscribe URL for the emails.

NEWSFEED_EMAIL_CONFIRMATION_EXPIRE_DAYS

  • default: 3 (after number of days confirmation link expires)
  • required: False

This settings tells django-newsfeed to expire the confirmation link in specified number of days.

NEWSFEED_EMAIL_BATCH_SIZE

  • default: 0 (number of emails per batch)
  • required: False

This settings is helpful when there are a lot of subscribers. This settings tells django-newsfeed to send the specified number of emails per batch. if its zero (0) then all of the emails will be sent together.

NEWSFEED_EMAIL_BATCH_WAIT

  • default: 0 (in seconds)
  • required: False

This settings tells django-newsfeed how long it should wait between each batch of newsletter email sent.

NEWSFEED_SUBSCRIPTION_REDIRECT_URL

  • default: /newsfeed/issues/
  • required: False

This is only required if you are not using ajax request on the subscription form. The JavaScript code for ajax is included with django-newsfeed and on by default.

NEWSFEED_UNSUBSCRIPTION_REDIRECT_URL

  • default: /newsfeed/issues/
  • required: False

This is only required if you are not using ajax request on the unsubscription form. The JavaScript code for ajax is included with django-newsfeed and on by default.

Signals

django-newsfeed sends several signals for various actions. You can add receivers to listen to the signals and add your own functionality after each signal is sent. To learn more about signals refer to django Signals Documentation.

Subscriber Signals

  • newsfeed.signals.email_verification_sent(instance)
    Sent after email verification is sent, with Subscriber instance.
  • newsfeed.signals.subscribed(instance)
    Sent after subscription is confirmed, with Subscriber instance.
  • newsfeed.signals.unsubscribed(instance)
    Sent after unsubscription is successful, with Subscriber instance.

Contribute

See CONTRIBUTING.rst for information about contributing to django-newsfeed.

License

The code in this project is released under the GNU General Public License v3.0

More Repositories

1

banking-system

A Banking System Concept Created Using Django Python Web Framework and Tailwind CSS
Python
265
star
2

changelog-ci

Changelog CI is a GitHub Action that enables a project to automatically generate changelogs
Python
115
star
3

redis-search-django

Django package that provides auto indexing and searching capabilities for Django model instances using RediSearch.
Python
86
star
4

github-action-utils

Collection of python functions that can be used to run GitHub Action Workflow Commands
Python
67
star
5

github-actions-version-updater

A GitHub Action that Updates All GitHub Actions in a Repository and Creates a Pull Request with the Updates
Python
67
star
6

python-third-party-imports

A Python CLI tool (Written in Rust) that finds all third-party packages imported into your Python project
Rust
38
star
7

comment-webpage-screenshot

A GitHub Action that Helps to Visually Review HTML file changes on a Pull Request by adding comments with the screenshots of the HTML file changes on the PR
Python
25
star
8

drf-test-generator

A Django Package that generates basic unittest and pytest style tests for Django REST Framework ViewSets
Python
23
star
9

Restaurant-Website

This is a Restaurant Website Github Repository.
JavaScript
15
star
10

test-django-newsfeed

HTML
9
star
11

django-todo

Django Todo List API with Firebase Firestore Database
Python
7
star
12

logbook-cli

Command Line Tool to Keep Your Daily Events Recorded. Made with Python, Typer & SQLAlchemy
Python
6
star
13

your-query

This is a Question Answer Website. Users Can Ask & Answer Questions.
JavaScript
6
star
14

name-letter-picture-generator

Create YouTube, Skype style profile picture using first letter of the name with random background color.
Python
6
star
15

placeholder-image-generator

A small python tool that generates placeholder images with specific dimensions and color
Python
4
star
16

django_excel_input

Upload Excel File to Django Database
Python
3
star
17

python_firebase_url_shortener

This is a Python Client for Firebase Dynamic Links to Create Short URLs.
Python
2
star
18

saadmk11.github.io

https://saadmk11.github.io/
HTML
1
star
19

PyObjectDetection

Jupyter Notebook
1
star
20

pharmacy-management-system

Python
1
star
21

node-express-demo

EJS
1
star
22

try-redis-search-django

Python
1
star
23

blog

Python
1
star
24

online-resume

Online Resume (Publish your Resume Online)
Python
1
star