Giter Club home page Giter Club logo

django-suit-flame's Introduction

Flame for Django Suit

Solves two problems:

  • Warns users when two people are editing the same object in the Django admin.
  • Autosaves the changes to firebase in real time and notifies the user if there are unsaved changes. If the user leaves the page for some reason, they can see their unsaved changes and apply them to the form.

The main problem

When two users are editing the same Django admin page at the same time, it is almost inevitable that one of the users will override the other’s changes.

Flame is the simplest solution to prevent this problem.

The solution

Use a pub-sub server to track active users and notify others when a change occurs.

save-notification

Autosave!

Many people use Django for content editing purposes. The biggest nightmare for an editor is to accidentally close the browser and lose all his work.

Modern web apps (Gmail, Google docs, etc.) already support autosave and lack of this feature in sites built with Django create a bad experience for the users.

No need to setup Tornado or a similar pubsub server.

Flame uses Firebase as the pubsub provider. Firebase is quite reliable and the free tier already supports up to 50 connections which should be enough for an admin site.

How does it work?

Flame syncs the contents of the change form regularly with Firebase. When the user saves the form, it deletes this data from Firebase.

However if the user leaves the page without saving the form, the unsaved data stays in the Firebase data store.

When the user reloads that page, he sees a notification box that says "You have unsaved changes." The user can choose to apply the changes to the form or ignore (and delete) this content forever.

Setting up

pip install django-suit-flame

Add suit_flame before django-suit into the INSTALLED_APPS setting

INSTALLED_APPS = (
    'suit_flame',
    'suit',

Create a new Firebase data store and add necessary keys to settings.py:

FLAME_AUTOSAVE = True
FLAME_FIREBASE_SUBDOMAIN = 'https://example-subdomain-136.firebaseio.com'
FLAME_FIREBASE_SECRET_KEY = 'e22bA3KOg54gfwr9lmoWyi1sg8dL8uwOg8txRyfl2'

Make sure to add necessary security settings at Firebase.

Go to your Firebase project settings and update the Security & Rules section with these ones:

{
    "rules": {
        ".read": "auth != null",
        ".write": "auth != null"
    }
}

This will ensure the privacy of your data.

Contributors

Made by Hipo

django-suit-flame's People

Contributors

taylanpince avatar umitdincel avatar yigitguler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

bopo

django-suit-flame's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.