https://github.com/jeffkit/django-favorites
favorites for django
https://github.com/jeffkit/django-favorites
Last synced: 4 months ago
JSON representation
favorites for django
- Host: GitHub
- URL: https://github.com/jeffkit/django-favorites
- Owner: jeffkit
- License: bsd-3-clause
- Created: 2014-04-29T10:32:33.000Z (about 12 years ago)
- Default Branch: develop
- Last Pushed: 2016-02-21T00:28:29.000Z (over 10 years ago)
- Last Synced: 2025-12-05T10:50:41.336Z (6 months ago)
- Language: Python
- Homepage:
- Size: 161 KB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#django-favorites
Favorite anything in Django.
## Install
install from pypi:
pip install django-favorites
install from source:
git clone https://github.com:jeffkit/django-favorites.git
cd django-favorites
sudo python setup.py install
## Play with django
add to install app:
INSTALLED_APPS = (
....
'favorites',
)
## Usage
### FavoriteManager
*create_favorite(user, obj):*
connect user with any kind of django model object obj.
from favorites.models import Favorite
Favorite.objects.create_favorite(user, obj)
*favorites_for_obj(obj):*
from favorites.models import Favorite
book = Book.objects.get(pk=1)
favs = Favorite.objects.favorites_for_obj(book)
*favorites_of_uer(user)*
from favorites.models import Favorite
user = User.objects.get(pk=1)
favs = Favorite.objects.favorites_for_user(user)
### Favorite Filters & Tags
django-favorites provider a set of tags and filters. before use them, load it.
<% load favorite_tags %>
#### Filters
*favorite_count*
display favorite count of obj.
{{user|favorite_count}}