Skip to content

Commit

Permalink
Merge 3660eec into 8fab669
Browse files Browse the repository at this point in the history
  • Loading branch information
rizumu committed Sep 18, 2015
2 parents 8fab669 + 3660eec commit d59e63f
Show file tree
Hide file tree
Showing 43 changed files with 244 additions and 208 deletions.
6 changes: 3 additions & 3 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[run]
source = phileo
omit = phileo/tests/*,phileo/admin.py
source = pinax
omit = pinax/likes/tests/*,pinax/likes/admin.py
branch = true

[report]
omit = phileo/tests/*,phileo/admin.py
omit = pinax/likes/tests/*,pinax/likes/admin.py
12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
build
dist
.coverage
.tox
MANIFEST
*.pyc
*.egg-info
dist/
.tox
.coverage
htmlcov
*.egg
docs/_build/
htmlcov/
3 changes: 3 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
James Taubers <jtauber@jtauber.com>
Brian Rosner <brosner@gmail.com>
Patrick Altman <paltman@gmail.com>
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The MIT License (MIT)
#
# Copyright (c) 2014 James Tauber and contributors
# Copyright (c) 2014-2015 James Tauber and contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
include AUTHORS
include LICENSE
include README.rst
recursive-include phileo/templates *
recursive-include pinax/likes/templates *
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
all: init docs test

init:
python setup.py develop
pip install tox coverage Sphinx

test:
coverage erase
tox
coverage html

docs: documentation

documentation:
python setup.py build_sphinx
38 changes: 17 additions & 21 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,48 +1,46 @@
======
Phileo
======
Pinax Likes
=============

.. image:: http://slack.pinaxproject.com/badge.svg
:target: http://slack.pinaxproject.com/

.. image:: https://img.shields.io/travis/pinax/phileo.svg
:target: https://travis-ci.org/pinax/phileo
.. image:: https://img.shields.io/travis/pinax/pinax-likes.svg
:target: https://travis-ci.org/<user_or_org_name>/pinax-likes

.. image:: https://img.shields.io/coveralls/pinax/phileo.svg
:target: https://coveralls.io/r/pinax/phileo
.. image:: https://img.shields.io/coveralls/pinax/pinax-likes.svg
:target: https://coveralls.io/r/<user_or_org_name>/pinax-likes

.. image:: https://img.shields.io/pypi/dm/phileo.svg
:target: https://pypi.python.org/pypi/phileo/
.. image:: https://img.shields.io/pypi/dm/pinax-likes.svg
:target: https://pypi.python.org/pypi/pinax-likes/

.. image:: https://img.shields.io/pypi/v/phileo.svg
:target: https://pypi.python.org/pypi/phileo/
.. image:: https://img.shields.io/pypi/v/pinax-likes.svg
:target: https://pypi.python.org/pypi/pinax-likes/

.. image:: https://img.shields.io/badge/license-MIT-blue.svg
:target: https://pypi.python.org/pypi/phileo/
:target: https://pypi.python.org/pypi/pinax-likes/


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.
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.

This app was developed as part of the Pinax ecosystem but is just a Django app and can be used independently of other Pinax apps.


phileo
-------
pinax-likes
-----------

``phileo`` is a liking app for Django.
``pinax-likes`` is a liking app for Django.


Documentation
-------------

The phileo documentation can be found online at http://phileo.readthedocs.org/.
The Pinax documentation is available at http://pinaxproject.com/pinax/.



Code of Conduct
-----------------

Expand All @@ -53,5 +51,3 @@ 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.


8 changes: 4 additions & 4 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ qthelp:
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/phileo.qhcp"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/likes.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/phileo.qhc"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/likes.qhc"

devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/phileo"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/phileo"
@echo "# mkdir -p $$HOME/.local/share/devhelp/likes"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/likes"
@echo "# devhelp"

epub:
Expand Down
24 changes: 12 additions & 12 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ChangeLog

- ``like_text_off`` and ``css_class_off`` are passed into widget even if
``can_like`` is False.
- ``PHILEO_LIKABLE_MODELS`` entries now take an optional extra value
- ``PINAX_LIKES_LIKABLE_MODELS`` entries now take an optional extra value
``allowed`` whose value should be a callable taking ``user`` and ``obj`` and
returning True or False depending on whether the user is allowed to like
that particular object
Expand All @@ -35,7 +35,7 @@ ChangeLog
0.6
---

- Added a `phileo_widget_brief` to display a brief widget template (`phileo/_widget_brief.html`)
- Added a `likes_widget_brief` to display a brief widget template (`likes/_widget_brief.html`)


0.5
Expand All @@ -60,25 +60,25 @@ ChangeLog
Backward Incompatibilities
^^^^^^^^^^^^^^^^^^^^^^^^^^

- Added an auth_backend to check permissions, you can just add the `phileo.auth_backends.PermCheckBackend`
and do nothing else, or you can implement you own backend checking the `phileo.can_like`
- Added an auth_backend to check permissions, you can just add the `likes.auth_backends.PermCheckBackend`
and do nothing else, or you can implement you own backend checking the `likes.can_like`
permission against the object and user according to your own business logic.
- No more ``phileo_css``, ``phileo_js``, or ``phileo_widget_js`` tags.
- ``PHILEO_LIKABLE_MODELS`` has changed from a ``list`` to a ``dict``
- ``phileo_widget`` optional parameters have been removed and instead put into per model settings
- No more ``likes_css``, ``likes_js``, or ``likes_widget_js`` tags.
- ``PINAX_LIKES_LIKABLE_MODELS`` has changed from a ``list`` to a ``dict``
- ``likes_widget`` optional parameters have been removed and instead put into per model settings


0.3
---

- Renamed `likes_css` and `likes_widget` to `phileo_css` and `phileo_widget`
- Renamed `likes_css` and `likes_widget` to `likes_css` and `likes_widget`
- Turned the JavaScript code in to a jQuery plugin, removed most of the initialization
code from the individual widget templates to a external JavaScript file, and added a
{% phileo_js %} tag to load this plugin.
{% likes_js %} tag to load this plugin.
- Each like button gets a unique ID, so multiple like buttons can appear on a single
page
- The like form works without JavaScript.
- Likeable models need to be added to `PHILEO_LIKABLE_MODELS` setting. This prevents users
- Likeable models need to be added to `PINAX_LIKES_LIKABLE_MODELS` setting. This prevents users
from liking anything and everything, which could potentially lead to security problems
(eg. liking entries in permission tables, and thus seeing their content; liking
administrative users and thus getting their username).
Expand All @@ -95,15 +95,15 @@ Backward Incompatibilities

- made it easier to get rolling with a like widget using default markup and javascript
- added returning the like counts for an object when it is liked or unliked so that the
widget (either your own or using the one that ships with phileo) can update via AJAX
widget (either your own or using the one that ships with likes) can update via AJAX

Backward Incompatibilities
^^^^^^^^^^^^^^^^^^^^^^^^^^

- removed `likes_ajax` and `likes_form` template tags so if you were using them and had
written custom overrides in _ajax.js and _form.html you'll need to plan your upgrade
accordingly.
- changed the url pattern, `phileo_like_toggle`, for likes to not require the user pk,
- changed the url pattern, `likes_like_toggle`, for likes to not require the user pk,
instead, the view handling the POST to this url, uses request.user.
- changed the ajax returned by the `like_toggle` view so that it now just returns a
single element: {"likes_count": <some-number>}
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
templates_path = []
source_suffix = '.rst'
master_doc = 'index'
project = u'phileo'
project = u'likes'
copyright = u'2014, James Tauber and Contributors'
exclude_patterns = ['_build']
pygments_style = 'sphinx'
Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
======
phileo
likes
======

A liking app

Development
-----------

The source repository can be found at https://github.com/pinax/phileo
The source repository can be found at https://github.com/pinax/likes


Contents
Expand Down
22 changes: 11 additions & 11 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,36 @@ perform a redirect.
Installation
============

* To install phileo::
* To install likes::

pip install phileo
pip install likes

* Add ``'phileo'`` to your ``INSTALLED_APPS`` setting::
* Add ``'likes'`` to your ``INSTALLED_APPS`` setting::

INSTALLED_APPS = (
# other apps
"phileo",
"likes",
)

* Add the models that you want to be likeable to ``PHILEO_LIKABLE_MODELS``::
* Add the models that you want to be likeable to ``PINAX_LIKES_LIKABLE_MODELS``::

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

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

AUTHENTICATION_BACKENDS = [
...
"phileo.auth_backends.CanLikeBackend",
"likes.auth_backends.CanLikeBackend",
...
]

* Lastly you will want to add `phileo.urls` to your urls definition::
* Lastly you will want to add `likes.urls` to your urls definition::

...
url(r"^likes/", include("phileo.urls")),
url(r"^likes/", include("likes.urls")),
...

.. _eldarion-ajax: https://github.com/eldarion/eldarion-ajax
4 changes: 2 additions & 2 deletions docs/signals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Both of these signals are sent from the Like model in the view that
processes the toggling of likes and unlikes.


phileo.signals.object_liked
likes.signals.object_liked
^^^^^^^^^^^^^^^^^^^^^^^^^^^

This signal is sent immediately after the object is liked and
provides the single kwarg of "like" which is the instance of the
Like object that was created.


phileo.signals.object_unliked
likes.signals.object_unliked
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This signal is sent immediately after the object is unliked and
Expand Down
18 changes: 9 additions & 9 deletions docs/templatetags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,29 @@ render. Any of them can be overwritten as needed, allowing you to
customize the rendering of the like on a per model and per application
basis:

* phileo/app_name/model.html
* phileo/app_name/like.html
* phileo/_like.html
* likes/app_name/model.html
* likes/app_name/like.html
* likes/_like.html


phileo_widget
likes_widget
-------------

This renders a fragment of html that will be what the user will click
on to unlike or like objects. It only has two required parameters, which
are the user and the object.::

{% phileo_widget user object %}
{% likes_widget user object %}


It renders "phileo/_widget.html" and can be overridden as desired.
It renders "likes/_widget.html" and can be overridden as desired.


phileo_widget_brief
likes_widget_brief
-------------------

Same, functionally, as `phileo_widget`, except that it renders
"phileo/_widget_brief.html" instead.
Same, functionally, as `likes_widget`, except that it renders
"likes/_widget_brief.html" instead.


liked
Expand Down
8 changes: 4 additions & 4 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ In your settings
----------------

You need to add each model that you want to be likable to the
`PHILEO_LIKABLE_MODELS` setting::
`PINAX_LIKES_LIKABLE_MODELS` setting::

PHILEO_LIKABLE_MODELS = {
PINAX_LIKES_LIKABLE_MODELS = {
"profiles.Profile": {},
"videos.Video": {},
"biblion.Post": {},
Expand All @@ -22,12 +22,12 @@ In the templates
Let's say you have a detail page for a blog post. First you will want
to load the tags::

{% load phileo_tags %}
{% load likes_tags %}


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

{% phileo_widget request.user post %}
{% likes_widget request.user post %}


That's all you need to do to get the basics working.
4 changes: 0 additions & 4 deletions phileo/__init__.py

This file was deleted.

Loading

0 comments on commit d59e63f

Please sign in to comment.