Django-follow-system

Latest version: v0.0.4

Safety actively analyzes 675368 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

0.0.4

Features

- `{% url 'get_followers' %}?username={{ username }}`

0.0.2

- user follow
- user unfollow
- get follow and following list with rest API
- get follower count
- get following count

django_follow_system
Django user follower system

install
`pip install django-follow-system`

Usage

**/settings.py**

python

INSTALLED_APPS = [
...
...
...
"django_follow_system",
]



python
>>> python manage.py makemigrations django_follow_system
>>> python manage.py migrate


**/urls.py**
python
urlpatterns = [
path("follow/", include("django_follow_system.urls")),
]


**/templates**


{% load django_follow_system_tags %}

{{ request.user|following_count }}
{{ request.user|follower_count }}

{% if request.user|is_follow:current_user %}
Unfollow
{% else %}
Follow
{% endif %}


python

>>> request.user.follow.follower
>>> request.user.follow.following



Follow Request
Get Follow Request
- After login
- send get request this address {% url 'follow' other_user %}

Get Unfollow Request
- After login
- send get request this address {% url 'follow' other_user %}

Example with JS
js
$(document).ready(function() {
$(".follow-op").click(function(event){
let follower_count = parseInt(document.getElementById("follower_count").innerHTML);
$.get("{% url 'follow' other_user %}", function(data, status){
if (data.status == "follow"){
$("follower_count").html(follower_count+1);
$("follow-op follow").html("Unfollow");
}
else if (data.status == "unfollow"){
$("follower_count").html(follower_count-1);
$("follow-op follow").html("Follow");
}
});
});
});



Get Followers and Following with Rest API
{% url 'get_followers' %}

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.