django-likeit
A simple app for Django that enables users to like and unlike any object/item within any model. It’s developed on Python 3.5 & Python 3.6 for Django 1.10 and later.
Installation
Install django-likeit in your vilrtual env:
pip install django-likeit
Add the app to your settings.py
INSTALLED_APPS = [
...
"like",
...
]
Add likeit urls to your project’s urls.py file:
from django.conf.urls import url, include
urlpatterns = [
...
url(r'^like/', include('like.urls')),
...
]
Migrations:
python manage.py makemigrations like python manage.py migrate
Make sure you have jQuery ajax CSRF configuration right, and also you included Font Awesome in your HTML.
Usage:
Likes Manager
Create a Like instance for a user and object:
>>> from django.contrib.auth.models import User
>>> from music.models import Song
>>> user = User.objects.get(username='jdoe')
>>> song = Song.objects.get(pk=1)
>>> like = Like.objects.create(user, song)
or:
>>> like = Like.objects.create(user, 1, Song)
or:
>>> like = Like.objects.create(user, 1, "music.Song")
Get the objects liked by a given user:
>>> from django.contrib.auth.models import User
>>> user = User.objects.get(username='jdoe')
>>> Like.objects.for_user(user)
>>> [<Like: Like object 1>, <Like: Like object 2>, <Like: Like object 3>]
Now, get user liked objects belonging to a given model:
>>> from django.contrib.auth.models import User
>>> from music.models import Song
>>> user = User.objects.get(username='jdoe')
>>> Like.objects.for_user(user, model=Song)
>>> [<Like: Like object 1>, <Like: Like object 2>, <Like: Like object 3>]
Get the liked object instances of a given model liked by any user:
>>> from music.models import Song
>>> Like.objects.for_model(Song)
>>> [<Like: Like object 1>, <Like: Like object 2>, <Like: Like object 3>]
Get a Like instance for a given object and user:
>>> from django.contrib.auth.models import User
>>> from music.models import Song
>>> user = User.objects.get(username='jdoe')
>>> song = Song.objects.get(pk=1)
>>> like = Like.objects.get_like(user, song)
Get all Like instances for a given object
>>> from music.models import Song
>>> song = Song.objects.get(pk=1)
>>> like = Like.objects.for_object(song)
Metadata
Release files for django-likeit 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-likeit-0.1.2.tar.gz | 6.3 kB | Without provenance | Details for django-likeit-0.1.2.tar.gz |
Release files / django-likeit-0.1.2.tar.gz
| Download URL | django-likeit-0.1.2.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
016e5578b0b710dfcccfd7dbc1a1ad61efc093f1ac0a455b8d3a2566b1a61b36
|
|
BLAKE2b-256 checksum How to use checksums |
466a71575ada7e26ad10622efb55a1a822df62dcd1feed3d93d40706064532a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-likeit 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.