Giter Club home page Giter Club logo

djtreesaver's Introduction

djTreesaver

Introduction

djTreesaver is a plugin Django app that makes publishing content to Treesaver.js quick and easy. It includes all the required models, views, and templates for creating a Treesaver publication. It even allows you to upload epub files and automatically convert them into Treesaver documents.

Requirements

django :: https://www.djangoproject.com/
BeautifulSoup :: http://www.crummy.com/software/BeautifulSoup/
PIL :: http://www.pythonware.com/products/pil/
Sass :: http://sass-lang.com/

Installation

  1. Copy the djTreesaver directory into your Django Project.

  2. Make sure MEDIA_ROOT and MEDIA_URL are set correctly in your settings.py file. djTreesaver will create 3 sub directories here to store uploaded files: epubs, grids, and images. epubs stores uploaded epub files. grids stores uploaded article grid html files and the associated Sass file. images contains image files that are linked to an article.

  3. Add djTreesaver to your installed apps tuple

     INSTALLED_APPS = (
         ...
         'djTreesaver',
         ...
     )
    
  4. Add the djTreesaver urls file to your urls.py file

     urlpatterns = patterns('',    
         # djTreesaver
         (r'^treesaver/', include('djTreesaver.urls')),
         ...
     )
    
  5. From the Django Admin Site, upload a Treesaver grid by using the DjTreesaver -> Grids form. You can use one of the example grids in the djTreesaver/example_grids/ directory. You can read more about grids here: http://treesaverjs.com/

Usage

Converting an Epub

From the Django Admin Site, upload an epub to DjTreesaver -> Epub form. Select a publication to categorize the epub. For example, if you upload Minority Report by Philip K. Dick, you might want to select a publication called Science Fiction or Classics. If the Epub is an issue of a periodical, the publication should be the name of the periodical.

Once the epub is uploaded and saved, you'll find issue in DjTreesaver -> Issue's. Take note of the issue's primary key and navigate to /treesaver/issue/<pk>/, for example, /treesaver/issue/1/.

Manually creating an issue

Manually creating a Treesaver issue is almost as easy as uploading an epub:

from djTreesaver.models import Image, Publication, Issue, Article
from django.core.files.base import ContentFile
from django.core.urlresolvers import reverse

haxor_monthly = Publication(name="Haxor Monthly")
haxor_monthly.save()

july_cover = Image()
july_cover.image.save('/some/dir/tory/', ContentFile(file_object.read()))
july_cover.alt = "Alt Text"
july_cover.title = "Title Text"
july_cover.save()

july_issue = Issue()
july_issue.title = "Awesomeness"
july_issue.uuid = "0000-0000-0000-0000"
july_issue.publication = haxor_monthly
july_issue.cover = july_cover
july_issue.save()

an_image = Image()
an_image.image.save('/some/dir/tory/', ContentFile(file_object.read()))
an_image.alt = "Alt Text"
an_image.title = "Title Text"
an_image.save()

an_article = Article()
an_article.title = "Hello World"
an_article.slug = "hello-world"
an_article.author = "Craig Weber"
an_article.issue = july_issue
an_article.content = article_html_content_string
an_article.images.add(an_image)  # ManyToManyField
an_article.save()

# Link to the issue like this
issue_url = reverse('djTreesaver.views.view_issue', kwargs={'issue':july_issue.pk,})

Credits

Thanks to Filipe Fortes and Bram Stein for Treesaver :: http://treesaverjs.com/

Seasons is created and developed by Scott Kellum in collaboration with the Treesaver team :: http://treesaver.net/

djtreesaver's People

Contributors

crgwbr avatar scottkellum avatar

Stargazers

Rene Nederhand avatar

Watchers

James Cloos avatar Rene Nederhand avatar

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.