Skip to content

Commit

Permalink
Improving documenation
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamu committed Apr 16, 2016
1 parent e0f8a52 commit 9fac0cd
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 191 deletions.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Pinax Likes

[![](http://slack.pinaxproject.com/badge.svg)](http://slack.pinaxproject.com/)
[![](https://img.shields.io/travis/pinax/pinax-likes.svg)](https://travis-ci.org/pinax/pinax-likes)
[![](https://img.shields.io/coveralls/pinax/pinax-likes.svg)](https://coveralls.io/r/pinax/pinax-likes)
[![](https://img.shields.io/pypi/dm/pinax-likes.svg)](https://pypi.python.org/pypi/pinax-likes/)
[![](https://img.shields.io/pypi/v/pinax-likes.svg)](https://pypi.python.org/pypi/pinax-likes/)
[![](https://img.shields.io/badge/license-MIT-blue.svg)](https://pypi.python.org/pypi/pinax-likes/)

## Pinax

[Pinax](http://pinaxproject.com/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 app is part of the Pinax ecosystem and is designed for use both with and
independently of other Pinax apps.

## pinax-likes

``pinax-likes`` is a liking app for Django, allowing users to "like" and "unlike"
any model instance in your project. Template tags provide the ability to see who
liked an object, what objects a user liked, and more.

## Getting Started and Documentation

Follow steps outlined in [Pinax Likes Documentation](docs/index.md).

## Contribute

See [this blog post](http://blog.pinaxproject.com/2016/02/26/recap-february-pinax-hangout/) including a video, or our [How to Contribute](http://pinaxproject.com/pinax/how_to_contribute/) section for an overview on how contributing to Pinax works. For concrete contribution ideas, please see our [Ways to Contribute/What We Need Help With](http://pinaxproject.com/pinax/ways_to_contribute/) section.

In case of any questions we recommend you [join our Pinax Slack team](http://slack.pinaxproject.com) and ping us there instead of creating an issue on GitHub. Creating issues on GitHub is of course also valid but we are usually able to help you faster if you ping us in Slack.

We also highly recommend reading our [Open Source and Self-Care blog post](http://blog.pinaxproject.com/2016/01/19/open-source-and-self-care/).


## Code of Conduct

In order to foster a kind, inclusive, and harassment-free community, the Pinax Project has a code of conduct, which can be found here http://pinaxproject.com/pinax/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.


## Pinax Project Blog and Twitter

For updates and news regarding the Pinax Project, please follow us on Twitter at @pinaxproject and check out our blog http://blog.pinaxproject.com.
73 changes: 0 additions & 73 deletions README.rst

This file was deleted.

54 changes: 0 additions & 54 deletions docs/ajax.md

This file was deleted.

4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ChangeLog

## 2.0.2

- Improve documentation

## 2.0.1

- Converted documentation to Markdown format
Expand Down
7 changes: 1 addition & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# pinax-likes

[Pinax](http://pinaxproject.com/pinax/) is an open source ecosystem
of reusable Django apps, themes, and starter project templates.

As a reusable Django app, `pinax-likes` provides the ecosystem with
a well tested, documented, and proven solution for any site that
`pinax-likes` is a well tested, documented, and proven solution for any site that
that wants to support "likes".

## Contents
Expand All @@ -13,7 +9,6 @@ that wants to support "likes".
* [Usage](./usage.md)
* [Template tags](./templatetags.md)
* [Signals](./signals.md)
* [AJAX](./ajax.md)
* [Changelog](./changelog.md)

## Development
Expand Down
73 changes: 26 additions & 47 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,39 @@
# Requirements

The view to handle the like toggling conforms to an `AJAX` response that
[eldarion-ajax](https://github.com/eldarion/eldarion-ajax) understands.
Furthermore, the templates that ship with this project will work
seemlessly with `eldarion-ajax`. All you have to do is include the
`eldarion-ajax` in your base template somewhere like:


{% load staticfiles %}
<script src="{% static "js/eldarion-ajax.min.js" %}"></script>


and include `eldarion-ajax` somewhere in your site JavaScript:


require('eldarion-ajax');


This of course is optional. You can roll your own JavaScript handling as
the view also returns data in addition to rendered HTML. Furthermore, if
you don't want `ajax` at all the view will handle a regular `POST` and
perform a redirect.

# Installation

- To install likes:

pip install pinax-likes

- Add `pinax.likes` to your `INSTALLED_APPS` setting:


INSTALLED_APPS = (
# other apps
"pinax.likes",
)
To install pinax-likes:

- Add the models that you want to be likable to
`PINAX_LIKES_LIKABLE_MODELS`:
pip install pinax-likes

PINAX_LIKES_LIKABLE_MODELS = {
"app.Model": {} # can override default config settings for each model here
}
Add `pinax.likes` to your `INSTALLED_APPS` setting:

- Add `pinax.likes.auth_backends.CanLikeBackend` to your
`AUTHENTICATION_BACKENDS` (or use your own custom version checking
against the `pinax.likes.can_like` permission):
INSTALLED_APPS = (
...
"pinax.likes",
...
)

Add the models that you want to be likable to `PINAX_LIKES_LIKABLE_MODELS`:

AUTHENTICATION_BACKENDS = [
PINAX_LIKES_LIKABLE_MODELS = {
"app.Model": {} # can override default config settings for each model here
}

pinax.likes.auth_backends.CanLikeBackend,
Add `pinax.likes.auth_backends.CanLikeBackend` to your
`AUTHENTICATION_BACKENDS` (or use your own custom version checking
against the `pinax.likes.can_like` permission):

]
AUTHENTICATION_BACKENDS = [
...
pinax.likes.auth_backends.CanLikeBackend,
...
]

- Lastly you will want to add `pinax.likes.urls` to your urls definition:
Lastly add `pinax.likes.urls` to your project urlpatterns:

urlpatterns = [
...
url(r"^likes/", include("pinax.likes.urls", namespace="pinax_likes")),
...
]

See [Usage](./usage.md) for details about integrating pinax-likes with your project.
31 changes: 22 additions & 9 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
# Usage

## In your settings
## Settings

Add each model that you want to be likable to the `PINAX_LIKES_LIKABLE_MODELS` setting:


PINAX_LIKES_LIKABLE_MODELS = {
"profiles.Profile": {},
"videos.Video": {},
"biblion.Post": {},
}

## Templates

## In the templates
Let's say you have a detail page for a blog post. First load the template tags:

Let's say you have a detail page for a blog post. First you will want to
load the tags:
{% load pinax_likes_tags %}

In the body where you want the liking widget to go, add:

{% load pinax_likes_tags %}
{% likes_widget request.user post %}

Finally, ensure you have `eldarion-ajax` installed:

In the body where you want the liking widget to go, add:
### Eldarion AJAX

The `likes_widget` templatetag above and the "toggle like" view both conform
to an `AJAX` response that [eldarion-ajax](https://github.com/eldarion/eldarion-ajax) understands.
Furthermore, the templates that ship with this project will work
seemlessly with `eldarion-ajax`. All you have to do is include the
eldarion-ajax.min.js Javascript package in your base template:

{% likes_widget request.user post %}
{% load staticfiles %}
<script src="{% static "js/eldarion-ajax.min.js" %}"></script>

and include `eldarion-ajax` in your site JavaScript:

require('eldarion-ajax');

That's all you need to do to get the basics working.
This of course is optional. You can roll your own JavaScript handling as
the view also returns data in addition to rendered HTML. Furthermore, if
you don't want `ajax` at all the view will handle a regular `POST` and
perform a redirect.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def read(*parts):
author_email="team@pinaxproject.com",
description="a liking app for Django",
name="pinax-likes",
long_description=read("README.rst"),
version="2.0.1",
long_description=read("README.md"),
version="2.0.2",
url="http://github.com/pinax/pinax-likes/",
license="MIT",
packages=find_packages(),
Expand Down

0 comments on commit 9fac0cd

Please sign in to comment.